|
Hi,
I want to have multiline items in my CTreeCtrl. Therefore I use Custom Draw and the drawing works perfect!
but I have 2 issues:
First I have to know how I can draw the ExpandBox (the box with + and -) left of the Treeitems. Is there any API-function or do I have to create an icon and draw it by myself?
The next issue is related to the position of the rootlines. How can I get the coordinates of the rootlines?
Has somebody of you done this yet? Or do you know some good links?
|
|
|
|
|
I did something similiar to what you need in this article which handles the printing of a tree control. It shouldn't be too hard to modify it to do what you need. I handled the special +/- | icons by using GDI to draw them (not too good but ok for printer). I have been thinking of changing these to icons in an image list and handling the drawing of them the same way as the item icons.
Anyway, here is the link Tree control print[^]
If you vote me down, my score will only get lower
|
|
|
|
|
thank you! i use an imagelist now
|
|
|
|
|
I went through the example code for text to speech conversion. I actually need to pass the text to that program by selectin text from Internet Explorer and then passing it to the VC++ application by some custom built button or right click option.
I'll be greatful if anyone helps me out.
|
|
|
|
|
Hello
I want to know how to add a toolbar button to Internet explorer just like we have the "Stop", "Refresh" and other buttons added.
Secondly i want to run a VC++ program when I click on that button. How to do this?
|
|
|
|
|
Hello!
I need to change the background of a tab control. I can change the background of the tab windows, but I don't know how to change the background of the surrounding frame, keeping the lines that give the frame-like look.
Does anyone know how to do that?
Thanks in advance.
-Alma-
|
|
|
|
|
I'm new C++ learner.
Now I have to convert DIALOG style of the source code into MDI.
Could any expert tell me how to do?
thanks a lot.
|
|
|
|
|
It's a very long task.... what I would do is to use AppWizard to create the MDI application skeleton. Then copy the relevant code from the dialog based application to the new generated one.
Jaime
|
|
|
|
|
Help !!!
Any idea?
|
|
|
|
|
If by "snapshot" you mean capture its bitmap to the clipboard, you might want to try this:/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Here is a win32 code:
<br />
int Screenshot(HDC hdc, char *pszflname)<br />
{<br />
HDC memdc;<br />
HANDLE hfl;<br />
DWORD dwBytes, dwWidth, dwHeight, dwNumColors, dwBPP, ColorSize;<br />
void *pBits;<br />
HBITMAP hbmp;<br />
BITMAPFILEHEADER fileheader;<br />
BITMAPINFOHEADER infoheader;<br />
RGBQUAD colors[256];<br />
BITMAPINFO bmpinfo;<br />
HGDIOBJ hret;<br />
<br />
dwWidth = GetDeviceCaps(hdc, HORZRES);<br />
dwHeight = GetDeviceCaps(hdc, VERTRES);<br />
dwBPP = GetDeviceCaps(hdc, BITSPIXEL);<br />
if (dwBPP <= 8)<br />
dwNumColors = 256;<br />
else<br />
dwNumColors = 0;<br />
if (!(memdc = CreateCompatibleDC(hdc)))<br />
return (0);<br />
bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br />
bmpinfo.bmiHeader.biWidth = dwWidth;<br />
bmpinfo.bmiHeader.biHeight = dwHeight;<br />
bmpinfo.bmiHeader.biPlanes = 1;<br />
bmpinfo.bmiHeader.biBitCount = (WORD)dwBPP;<br />
bmpinfo.bmiHeader.biCompression = BI_RGB;<br />
bmpinfo.bmiHeader.biSizeImage = 0;<br />
bmpinfo.bmiHeader.biXPelsPerMeter = 0;<br />
bmpinfo.bmiHeader.biYPelsPerMeter = 0;<br />
bmpinfo.bmiHeader.biClrUsed = dwNumColors;<br />
bmpinfo.bmiHeader.biClrImportant = dwNumColors;<br />
hbmp = CreateDIBSection(hdc, &bmpinfo, DIB_PAL_COLORS, &pBits, NULL, 0);<br />
if (!hbmp)<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
hret = SelectObject(memdc, hbmp);<br />
if (!hret || (hret == HGDI_ERROR))<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
if (!BitBlt(memdc, 0, 0, dwWidth, dwHeight, hdc, 0, 0, SRCCOPY))<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
if (dwNumColors)<br />
dwNumColors = GetDIBColorTable(memdc, 0, dwNumColors, colors);<br />
fileheader.bfType = 0x4D42;<br />
ColorSize = dwNumColors * sizeof(RGBQUAD);<br />
fileheader.bfSize = ((dwWidth*dwHeight*dwBPP) >> 3) + ColorSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);<br />
fileheader.bfReserved1 = fileheader.bfReserved2 = 0;<br />
fileheader.bfOffBits = ColorSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);<br />
infoheader.biSize = sizeof(BITMAPINFOHEADER);<br />
infoheader.biWidth = dwWidth;<br />
infoheader.biHeight = dwHeight;<br />
infoheader.biPlanes = 1;<br />
infoheader.biBitCount = (WORD)dwBPP;<br />
infoheader.biCompression = BI_RGB;<br />
infoheader.biSizeImage = infoheader.biClrImportant = 0;<br />
infoheader.biXPelsPerMeter = infoheader.biYPelsPerMeter = 0;<br />
infoheader.biClrUsed = dwNumColors;<br />
hfl = CreateFile(pszflname, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);<br />
if (hfl == INVALID_HANDLE_VALUE)<br />
{<br />
DeleteObject(hbmp);<br />
{<br />
DeleteDC(memdc);<br />
return (0);<br />
}<br />
}<br />
WriteFile(hfl, &fileheader, sizeof(BITMAPFILEHEADER), &dwBytes, 0);<br />
WriteFile(hfl, &infoheader, sizeof(BITMAPINFOHEADER), &dwBytes, 0);<br />
if (!dwNumColors)<br />
WriteFile(hfl, colors, ColorSize, &dwBytes, 0);<br />
ColorSize = (dwWidth * dwHeight * dwBPP) >> 3;<br />
WriteFile(hfl, pBits, ColorSize, &dwBytes, 0);<br />
CloseHandle(hfl);<br />
DeleteObject(hbmp);<br />
DeleteDC(memdc);<br />
return (1);<br />
}<br />
and you can use it like this
<br />
Screenshot(GetDC(GetDesktopWindow()), "myscreenshot.bmp");<br />
I hope this helps....
Well... I am a beginner ...
|
|
|
|
|
Simply Great!!!
A very useful code snippet.
Thanks a lot...
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
Hi,
I have a C++ DLL ( not MFC )which has a static method
say
class Test
{
static GetData();
Static GetParams();
bool TestDatat();
};
I am exporting this class and using in another DLL.
I built Test.dll,Test.lib.
Now i included in another DLL(say Samp.DLL):
Test.dll,Test.lib abd Test.h
in Samp.h file i inclued "Test.h" and linkedTest.lib and Placed Test.dll in Release/Debug folder.
I am calling Test::GetData() in Samp.DLL.
But after compiling Samp.DLL giving error like:
"error LNK 2001: unresolved external symbol. _declspec(dllimport) public:static bool _stdcall Test::GetDatta(char const *,bool)(_imp_?GetData@Test@SG_NPBD_N@Z)".
while building if i change project setttings "_cdecl*" in calling conventions, DLL is building fine,but failing to call a value from Samp.DLL by passing value to Test.DLL.
If i what to build my Samp.DLL by "_stdcall" convention how can i build this ?
Any help on this..
Thank you.
|
|
|
|
|
Have you exported using _declspec(dllexport) and imported using _declspec(dllimport)?
Can you show how you are importing and exporting?
Jaime
|
|
|
|
|
[edit] Regular DLLs don't You shouldn't [/edit] expose objects in a regular DLL (only ActiveX or MFC Extension DLLs) if you want the calling code to be something besides C++. You'll need to export a regular C-style function that serves as a wrapper to the method/property you are trying to invoke.
Jeremy Falcon
|
|
|
|
|
He's exporting a regular C++ class. Nothing magical about that, and is certainly possible with DLLs.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Possible, but not practical and in poor practice IMO. Because, if you do that, then your calling language has to be C++.
Jeremy Falcon
|
|
|
|
|
Hello,
I have a hevey problem your you out there,
I need to right a app that handle the "%1" %*
when a app start.
When a app start my app should start and then i want
to check what app thats realy starded how do i do that?
|
|
|
|
|
Please rephrase your question because I really don't understand what you are asking !!!
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Ok I Sorry,
That I need is,
When you start a app t:ex = "Notepad.exe"
I want my app to start but i need to see that it is notepad
and start the notepad with my app or that app that starts.
|
|
|
|
|
And i Need to do it with a MFC APP,
So this is what i want to do.
1) Put my app to exefiles So when you start a exe file my app will start.
2) Byt when my app(MFC) start i need to now what app realy started.
3) So if it is "Notepad" that starts i what to start notepad from my app.
But i dont now ho to do this can you help me?
|
|
|
|
|
I'm still not sure ...
Are you talking about file association ? for example, when double clicking on a text file it will start notepad.exe ? but you want to start your own application ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Yes that is what i want,
But i want to start the exefile in my app.
And it most be in a MFC app
|
|
|
|
|
You mean the register-setting in de CLASSES part of the registry, where there's a key called exefile.
You want to set a program in front of "%1" %* so it is called when an executable is started.
I think you mean you need the __argc en __argv[] vars. Read them out and you'll get you're arguments.
__argc = argument count
__argv[] = arguments, 0 = the program-file, 1,2,3,... the arguments.
Loading...
|
|
|
|
|
Yes that what i mean,
But how do i do this? And it must be a MFC app.
|
|
|
|