Re: error on CreateDialog

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I believe you have to change the .rc file to add the CLASS item in the
dialog resource. See

http://support.microsoft.com/?id=251059
How to provide your own Window class name for an MFC dialog box

BTW, this is not the correct newsgroup for SDK questions. Next time
try microsoft.public.vc.mfc newsgroup.
--
Cheers
Check Abdoul
-----------------


"hyf" <hyf.1wqchn@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:hyf.1wqchn@xxxxxxxxxxxxxxxxxxxxxxxx
>
> The error code is 6 with GetLastError£¨£©£¬
> First i registered a WNDCLASS£¬then I create a dialog¡£
> But it failed¡£
> My intent is to add an icon for the dialog in a dll.
> Someone can help me?
> Thanks.
> Code:
> wc.style = CS_HREDRAW | CS_VREDRAW ;
> wc.lpfnWndProc = (WNDPROC)WndProc ;//callback procedure
> wc.cbClsExtra = 0 ;
> wc.cbWndExtra = DLGWINDOWEXTRA ;
> wc.hInstance = tmp_hModule ;
> //dllmain input handle when attach process
> wc.hIcon = LoadIcon(tmp_hModule, MAKEINTRESOURCE(IDI_ICON1));
> wc.hCursor = LoadCursor (NULL, IDC_ARROW) ;
> wc.hbrBackground = GetStockObject (LTGRAY_BRUSH) ;
> wc.lpszMenuName = NULL ;
> wc.lpszClassName = szAppName;
> //defined as TCHAR szAppName[] = TEXT("OPERATIONPANEL");
> if(!RegisterClass(&wc)) return FALSE ;
>
> hwnd=CreateDialog(tmp_hModule,MAKEINTRESOURCE(IDD_TABLEDLG),0,WndProc);
> if(hwnd==NULL)
> {
> error=GetLastError();
> wsprintf(str,L"error=%d",GetLastError());
> MessageBox(NULL,str,L"CreateDialog",MB_OK);
> return FALSE;
> }
>
>
>
> --
> hyf
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>


.



Relevant Pages

  • Re: Tomatoes
    ... >I hope this isn't too far off topic - I couldn't find another newsgroup ... Good resource is rec.gardens - well attended. ... Prev by Date: ...
    (alt.home.repair)
  • Re: Newbie Inquiry: Making Video Loops
    ... This newsgroup is a great ... resource. ... John ... Prev by Date: ...
    (rec.video.desktop)
  • RE: Resource Scheduling
    ... Microsoft CSS Online Newsgroup Support ... This newsgroup only focuses on SBS technical issues. ... newsgroups so that they can be resolved in an efficient and timely manner. ... | Thread-Topic: Resource Scheduling ...
    (microsoft.public.windows.server.sbs)
  • Re: Newbie to MS Project - Need Help with Views
    ... future questions. ... please post your Project Server questions in the ... microsoft.public.project.server newsgroup, as this newsgroup is dedicated to ... the list of projects broken down by resource, but you won't be able to ...
    (microsoft.public.project)
  • RE: Resource Scheduling
    ... > This newsgroup only focuses on SBS technical issues. ... you may want to contact Microsoft CSS directly. ... > | Thread-Topic: Resource Scheduling ... > |> You can book the resource at the same time that you create the meeting. ...
    (microsoft.public.windows.server.sbs)