I need the comctl32.lib library for some stuff I'm doing in the windows api, but I don't want to download the SDK from Microsoft because it's to big. Where else can I get it?

Dani AI

Generated

comctl32.lib is simply the import library for comctl32.dll (the Windows Common Controls: ListView, TreeView, ProgressBar, etc.). It is shipped with Visual Studio and the Windows SDK — on machines that have those installed you normally find it under something like Program Files\Microsoft SDKs\Windows\<version>\Lib or Program Files\Microsoft Visual Studio\<version>\VC\lib. The runtime code is the DLL in System32; the .lib only tells the linker how to bind to that DLL.

If you have very slow internet (as does), the most practical, safe options are: ask a friend or use a public/broadband machine to copy only the files you need (the .lib and the relevant headers such as commctrl.h) and transfer them by USB or CD. suggested the same idea and it usually takes minutes. Ordering a CD as suggested is another fallback. Do not download .lib files from random mirrors — copy them from a legal SDK/Visual Studio install.

How to link or avoid the .lib:

#pragma comment(lib, "comctl32.lib")

or with MinGW:

g++ app.cpp -o app.exe -lcomctl32

If you want to avoid shipping/importing the .lib at all, dynamically load the DLL at runtime with LoadLibrary and GetProcAddress and call the functions via function pointers:

HMODULE h = LoadLibraryA("comctl32.dll");
FARPROC p = GetProcAddress(h, "SomeExport");
if (p) { typedef void (WINAPI *PFN)(); PFN fn = (PFN)p; fn(); }
FreeLibrary(h);

Troubleshooting: if the linker complains it cannot find comctl32.lib, run dir /s comctl32.lib from a command prompt to locate it, or add the SDK/VC lib folder to the LIB environment variable or VS Linker -> Additional Library Directories. As pointed out, dependency churn can bite you — if you find yourself needing many headers/libs, having someone grab the full SDK with a fast connection (or ordering the SDK media) is the least painful long-term solution.

Recommended Answers

All 7 Replies

>Where else can I get it?
You might be able to find it somewhere with google, but I'm willing to bet that the dependencies will kick your ass. It's a much better idea to just bite the bullet and download the SDK.

You might be able to find it somewhere with google, but I'm willing to bet that the dependencies will kick your ass. It's a much better idea to just bite the bullet and download the SDK.

The reason I'm asking is that I have dialup internet (highspeed isn't avalible in my area:( ) and it will take hours to download. I guess I'll try and get someone with highspeed to download it for me. Thanks for the reply Narue I didn't think about the dependencies.

Do you have a memory stick of some kind? Could you download it in an internet cafe or something and transfer it to your computer at home? Or, as you suggested, a friend? College? Work? School?

I think you can also at nominal cost, probably $5 to $10.

I think you can also at nominal cost, probably $5 to $10.

I tried that but the form kept saying that I hadn't filled in all the fields even though I had and I couldn't get it to work.

I just tried it and got all the way to the end where it asked for credit card info, then I stopped because it would have cost $8+ for USP

Thanks they must hve fixed it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.