A simple question...
-
I've begun to learn VC (MFC) few days ago. i want to make something using the "ExtractIcon()" function. the first paramter of this function (as written in MSDN) is a handle to instance of the application. How the hell do i get this handle? what should i send him as this first parameter? thanks a lot RG
-
I've begun to learn VC (MFC) few days ago. i want to make something using the "ExtractIcon()" function. the first paramter of this function (as written in MSDN) is a handle to instance of the application. How the hell do i get this handle? what should i send him as this first parameter? thanks a lot RG
Call AfxGetInstanceHandle -c ------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com
-
Call AfxGetInstanceHandle -c ------------------------------ Smaller Animals Software, Inc. http://www.smalleranimals.com
look at this code: ... HICON icon = ExtractAssociatedIcon(AfxGetInstanceHandle() , "D:\\file.fp", 0); ASERT(icon==NULL) static.Create(NULL, WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), this); static.SetIcon(icon); ... static is CStatic variable. i dont know why, but this code causes an error, the windows error message: "illigal operation" appears. and it happens only after i use this function.... have any ideas? thanks RG
-
look at this code: ... HICON icon = ExtractAssociatedIcon(AfxGetInstanceHandle() , "D:\\file.fp", 0); ASERT(icon==NULL) static.Create(NULL, WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), this); static.SetIcon(icon); ... static is CStatic variable. i dont know why, but this code causes an error, the windows error message: "illigal operation" appears. and it happens only after i use this function.... have any ideas? thanks RG
Do you mean ASSERT(icon != NULL) ?
-
look at this code: ... HICON icon = ExtractAssociatedIcon(AfxGetInstanceHandle() , "D:\\file.fp", 0); ASERT(icon==NULL) static.Create(NULL, WS_CHILD|WS_VISIBLE|SS_ICON|SS_CENTERIMAGE, CRect(10,10,150,50), this); static.SetIcon(icon); ... static is CStatic variable. i dont know why, but this code causes an error, the windows error message: "illigal operation" appears. and it happens only after i use this function.... have any ideas? thanks RG
As above about ASSERT;
ASSERT(icon != NULL);
And also, the icon variable has to be present for the lifetime of the static control - thus you must put it as a member variable of the class, or as a global variable. > Andrew.
-
As above about ASSERT;
ASSERT(icon != NULL);
And also, the icon variable has to be present for the lifetime of the static control - thus you must put it as a member variable of the class, or as a global variable. > Andrew.
You know, you COULD put it as a global variable... but then again, we also COULD write poor poor poor code... If I were you, i would stick to putting it as a member variable of the Document class or the View class...depends on how it is used... -Reid the C++/C# programmer (Caution: I am a teenager, and that means that I think I know everything...but probably don't...)
-
You know, you COULD put it as a global variable... but then again, we also COULD write poor poor poor code... If I were you, i would stick to putting it as a member variable of the Document class or the View class...depends on how it is used... -Reid the C++/C# programmer (Caution: I am a teenager, and that means that I think I know everything...but probably don't...)
Yes you're right about the global variable (obviously) but I said that because....hmmmm....don't know why I said that. You're right - it should be a member of the class that's using it. Truth be told, the reason I said global variable was because I thought maybe he wasn't doing OOP programming, in which case that's pretty much the only alternative. > Andrew.
-
Yes you're right about the global variable (obviously) but I said that because....hmmmm....don't know why I said that. You're right - it should be a member of the class that's using it. Truth be told, the reason I said global variable was because I thought maybe he wasn't doing OOP programming, in which case that's pretty much the only alternative. > Andrew.