win32 Subclass a StaticText Control and DefSubclassProc Problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

win32 Subclass a StaticText Control and DefSubclassProc Problem

Thomas Steinbach
Hello,

I have a small porgram (pure c and winapi) and I
need to subclass a static text control.

btw: with VS2008 all is working fine and compiles.
Subclassing works and all seems to be coded right.

btw2: I'm linking against the comctl32 lib (see below)
and using a manifest and initialize the common controls
with InitCommonControls(&icc)

btw3: If I compile I use this CFLAGS
CFLAGS  = -c -O2 -Wall -pedantic -Wno-long-long -ansi
and all was fine until I implemented the subclass

If I try to compile with MinGW (gcc 3.4.5)
I get the error: undefined reference to _DefSubclassProc@16
:-(

---snip---
"C:/pro/mingw3/bin/gcc.exe" -mwindows -s int/main.o int/main.res -o
bin/main.
exe -L"C:/pro/mingw3/lib/gcc/mingw32/3.4.5" -L"C:/pro/mingw3/lib" -L"./lib"
-L".
" -lshell32 -lshlwapi -ladvapi32 -lcomctl32
int/main.o:main.c:(.text+0xd0f): undefined reference to
`_DefSubclassProc@16'
collect2: ld returned 1 exit status
make: *** [bin/main.exe] Error 1
---snap---

If I subclass the static control I must use this function
[...]
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
[...]
at the end of the "OwnerDrawnStaticTextControl" Callback funtion.

When I look in commctrl.h I find the definition
3048 LRESULT WINAPI DefSubclassProc(HWND,UINT,WPARAM,LPARAM);

if I comment out in my source:
/*return DefSubclassProc(hWnd, uMsg, wParam, lParam);*/
the program compiles well, but it laks the subclassed dialog item,
but shows me the other common Controls are initilized well.

How can I fix this?
Hope that someone can help me.


Thomas


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.
Reply | Threaded
Open this post in threaded view
|

Re: win32 Subclass a StaticText Control and DefSubclassProc Problem

Tuomo Latto
Thomas Steinbach wrote:
> If I try to compile with MinGW (gcc 3.4.5)
> I get the error: undefined reference to _DefSubclassProc@16
...
> How can I fix this?
> Hope that someone can help me.

Try setting WINVER before including any headers.

--- clip ---
Minimum operating systems Windows XP
--- clip ---
(http://msdn.microsoft.com/en-us/library/bb776403(VS.85).aspx)



--
Tuomo

... Laugh and the world laughs at you


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.