Young India 99

YES-Young Energetic Sincere

Home
Instant Inspiration
Incredible India
Knowledge Transfer(KT)
Placement Puraan
VTU Results
Technical Stuff
Coders Adda
win32 snippets
Windows CE Basics
stock ticker PocketPC
Windows Custom Control
Concatenated SMS
Using Timers in Linux
IPC in Linux
Deadlock Detection Algo
Priority queue spinlocks
Sample Queue C++
Contact Us

 

 

 

1. Wininet usage:

1.Verifying internet connection:

 

if(!InternetCheckConnectionA ("http://xyz.com",FLAG_ICC_FORCE_CONNECTION,0))

      {

            return false;

           

      }

2.Open internet connection

hINet = InternetOpenA("Microsoft Internet Explorer", INTERNET_OPEN_TYPE_DIRECT,NULL, NULL, NULL);

3.Connect to internet

hConnection = InternetConnectA( hINet, “http://xyz.com”, 80 , NULL,NULL, INTERNET_SERVICE_HTTP, 0, 0 );

4.Open Http request

hData = HttpOpenRequestA( hConnection, “POST”,"/"/*search specifier etc*/, "HTTP/1.1", NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0 );

5.Send the http request

HttpSendRequestA( hData, NULL, 0, “content”,strlen(“content”));

6.Read the response

while( InternetReadFile(hData , buffer, BUF_SIZE, &dwRead ) )

 {

          if ( dwRead == 0 )

            {

                 

                  return 1;//end of reception

                 

            }

            Str.append(buffer);

}

--------------------------------***---------------------------------- 

2.Forced Redraw

InvalidateRect(ExHwnd, NULL, TRUE);

RedrawWindow(ExHwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW | RDW_UPDATENOW | RDW_INTERNALPAINT);

UpdateWindow(ExHwnd);

SetWindowPos(ExHwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER);

 

--------------------------------***---------------------------------- 

3. Applying visual styles

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

http://www.go4expert.com/forums/showthread.php?t=754

4.Implicit and Expliict linking

http://www.go4expert.com/forums/showthread.php?t=19693

http://www.go4expert.com/forums/showthread.php?t=19668

 

5.Changing the windows defualt styles

DWORD style = GetWindowLong(hWnd, GWL_STYLE);

style &= ~(WS_BORDER|WS_CAPTION|WS_THICKFRAME|WS_SYSMENU|WS_VISIBLE);

6.Starting one process by other process

HINSTANCE hInst = ShellExecuteA(0,                          

                                "open",  // Operation to perform

                                “Path of the .exe file”,  // Application name

                                "Command Line", // Additional parameters

                                 0,                     // Default directory

                                 SW_SHOW);

Or you can use CreateProcess(…) function

PROCESS_INFORMATION pi;

BOOL fsuccess=CreateProcess(TEXT("notepad.exe"), TEXT (“Cmd line arguments”), NULL, NULL, false, 0, NULL,NULL, NULL,&pi);

if(fsuccess)

{

CloseHandle(pi.hThread);

CloseHandle(pi.hProcess);

}