WinAPI Web Browser

Nov 27, 2011 at 11:49pm
I work this web browser project.But DialogBoxParam func is not running.

Web Browser.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <windows.h>
HINSTANCE hGetProcIDDLL =LoadLibrary("C:/WINDOWS/system32/atl.dll");
FARPROC lpfnGetProcessID = GetProcAddress(HMODULE (hGetProcIDDLL),"AtlAxWinInit");
DialogBoxParam(0,1001,0,hWndProc);
char title[]="WinAPI Web Browser";
LRESULT CALLBACK hWndProc(HWND hWnd,UINT uInt,WPARAM wparam,LPARAM lparam){
             switch(uInt)
             {   case WM_CLOSE:
                 {
                      exit(0);
                      break;}
                      case 0x2:{
                           PostQuitMessage(0);
                       break;  }
                       default:
                        return DefWindowProc(hWnd,uInt,wparam,lparam);  
             }}

int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hInstance2,LPSTR  lpstr,int number){
    WNDCLASS clas;
    MSG msg;
    HWND hWnd;
    clas.hInstance=hinstance;
    clas.lpszClassName=title;
    clas.lpfnWndProc=hWndProc;
    clas.hbrBackground=GetSysColorBrush(COLOR_3DFACE);
    RegisterClass(&clas);
    CreateWindow(clas.lpszClassName,title,WS_VISIBLE|0xcf0000,5,5,1050,950,0,0,hinstance,0);
    while(GetMessage(&msg,NULL,0,0)){
    TranslateMessage(&msg);
    DispatchMessage(&msg);
                                     }
    return msg.wParam;
    }


Web Browser.rc:
1
2
3
4
5
6
7
8
9
10
11
12
13
#define maindlg 1001
#define IDC_WEB 1002
#define IDC_STATIC1016 1016

maindlg DIALOGEX 0,0,569,343
CAPTION "WinAPI Web Browser"
FONT 8,"MS Sans Serif"
STYLE 0x10ca0800
EXSTYLE 0x00000000
BEGIN
	CONTROL "http://www.google.com",IDC_WEB,"AtlAxWin",0x50300000,3,3,561,318,0x00000200

END

How can i use DialogBoxParam in this?
Last edited on Nov 27, 2011 at 11:50pm
Nov 28, 2011 at 3:08am
Line #4 of Web Browser.cpp must go inside a function. It cannot be outside like if it were a variable.

Lines #2 and #3 of the same CPP file may or may not work. I have never initialized a variable with WinAPI calls before like you are doing. If it doesn't work, you'll have to move those calls to the WinMain() function.

At least the first problem of line #4 must be generating a compiler warning or error. Always post these. Don't make us guess what the problem is if the compiler already is telling you.
Nov 28, 2011 at 11:43am
I am trying tailor this project in this example:http://board.flatassembler.net/topic.php?t=6085

Topic archived. No new replies allowed.