|
Yes, you need to do something like this in your callback:
BOOL CALLBACK gfnEnumChildProc(HWND hWnd, LPARAM lParam)
{
TCHAR szClass[60];
::GetClassName(hWnd, szClass, sizeof(szClass)/sizeof(TCHAR));
DWORD dwStyle = ::GetWindowLong(hWnd, GWL_STYLE);
if (_tcsicmp(szClass, TEXT("Static")) == 0)
{ ... }
else if ((_tcsicmp(szClass, TEXT("Button")==0) && !(dwStyle & BS_OWNERDRAW))
{ ... }
else if (_tcsicmp(szClass, TEXT("RICHEDIT") == 0)
{ ... }
return TRUE;
}
|
|
|
|
|
try this. You need to know the handle of the dialog (containing the button) first. If you don't have that, you can use the similar scheme to find that.
HWND GetButton(HWND hDlgWnd, CString strButtonCaption)
{
HWND hwndT = NULL;
CHAR szClassName[40];
CString strCap;
CWnd* pBtn;
for (hwndT = ::GetWindow(hDlgWnd, GW_CHILD); hwndT;
hwndT = ::GetWindow(hwndT, GW_HWNDNEXT))
{
if (GetClassName(hwndT, szClassName, 40))
{
if (!lstrcmpi(szClassName, "Button"))
{
pBtn = CWnd::FromHandle(hwndT);
pBtn ->GetWindowText(strCap);
if(strCap == strButtonCaption)
return hwndT ;
}
}
}
return NULL;
}
Hope this helps.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
i need to know how i can hook a dll as in creat my own proxy dll so i can send and recive functions from the dll id like to hook, any info would be great, thanks!
|
|
|
|
|
Check Microsoft Detours library at:
Detours
|
|
|
|
|
Hello everybody!
How to create context menu with bitmap images?
If you have the sample of code, please send to my e-mail!!!
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
void CFORMPRINTINGView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
UpdateData(TRUE);
pDC->SetMapMode(MM_ANISOTROPIC);
CRect rcClient;
GetClientRect(rcClient);
pDC->DPtoLP(rcClient);
LOGFONT logFont;
logFont.lfHeight = 40;
logFont.lfEscapement = 0;
logFont.lfOrientation = 0;
logFont.lfWeight = FW_NORMAL;
logFont.lfItalic = 0;
logFont.lfUnderline = 0;
logFont.lfStrikeOut = 0;
logFont.lfCharSet = ANSI_CHARSET;
logFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
logFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
logFont.lfQuality = PROOF_QUALITY;
logFont.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
strcpy(logFont.lfFaceName, "Times New Roman");
CFont* font = new CFont;
font->CreateFontIndirect(&logFont);
CFont* oldFont = pDC->SelectObject(font);
pDC->TextOut(280,1090,"A B C D E F G H J I");
}
i am using th above mentioned codes to print preview a text.. But the above method producing a memory leak as after few minutes scrolling the print preview window the text are not displayed anymore.... Can somebody please advice me....
|
|
|
|
|
It's all very well to catch the old font, but you also need to select it back into the DC if you want to avoid the memory leak.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
This line :
CFont* font = new CFont;
is the cause of the leak. There is no corresponding delete and using new does not result in automatic deletion when leaving scope. If this font needs to stay around it should probably be a member of your view class.
|
|
|
|
|
|
BOOL CAsyncSocket::Create(UINT nSocketPort, int nSocketType,
long lEvent, LPCTSTR lpszSocketAddress)
{
if (Socket(nSocketType, lEvent))
{
if (Bind(nSocketPort,lpszSocketAddress))
return TRUE;
int nResult = GetLastError();
Close();
WSASetLastError(nResult);
}
return FALSE;
}
as the "Communication Services" said, only servers need Bind . no clients need it
|
|
|
|
|
Well, the subject pretty much says it all - I've just noticed that in debug builds of my app, the Print Preview has its buttons in German. In Release builds, it's back in English.
I've gone all through the project settings, and everything's set to English (UK). Windows is set to English (UK). I can't find anything in the system set to German (although I may not be looking in the right places).
I created a new project from scratch with the MFC appwizard just to see if new projects had the same thing... and there were German print preview buttons.
I can't find any other common dialogues where it's appearing in German.
Any ideas as to what to look for? (before I lose any more hair! )
Thanks,
Andy Hassall (andy@andyh.org)
Space - disk usage analysis tool
|
|
|
|
|
This might be a totally wrong guess, but perhaps your printer driver has been installed with the german language pack
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
How can I get rid of this in a SDI app? Thanks for the help.
-Matt Newman
-Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Set it to something else. I'm guessing you're talking about a title bar? If so, use SetWindowText.
Without a more detailed question, I can't give a more detailed answer.
Hope this helps,
Bill
|
|
|
|
|
Sorry about that. I am talking about the title bar. Thats what I was looking for.
-Matt Newman
-Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
In PreCreateWindow(), remove the FWS_ADDTOTITLE style.
--Mike--
My really out-of-date homepage
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I've tried to implement a dialog box so i can draw to it and make my own progress indicator, i tried using the CProgressCTRL class and have decided i could program my own, the only problem is that when i get a dc from the dialog box , it doesn't update after the first graphics command!
So i draw a white outline,and when i want to draw the progress in red for example it doesn't draw.
Infact it will only draw on the first graphics command the first time the OnDraw function is called unless i click off the dialog box, and then click back onto the dialog box and wait for it to update...
Please Help if u have drawn into a dialog box before... Also could u tell me the difference between WM_Paint and WM_Ncpaint
|
|
|
|
|
You're drawing direct to the dialog box ? You'll need to draw to a bitmap and then draw it in WM_ERASEBKGRD, otherwise your drawing will be erased by WM_PAINT.
WM_NCPAINT draws the non-client area ( the caption, etc. )
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hey all!
I use ShellExecute with "open" in my VC++ application to open a URL in the default browser. By default, IE "recycles" windows - it opens the new URL in some existing instance of itself. This must not happen - and I can't instruct each user to modify the settings in IE.
How do I open a URL, making sure it opens in a new IE window?
(Since the application is an ActiveX, I don't mind using IE to open the URL, and not the default browser. Is it possible to do this using some command-line parameters to IE? If so - what parameters should I use, and where in the registry to I find the location of IExplore.exe?)
Thanks!
|
|
|
|
|
start IE in this manner
iexplore.exe -new [url]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Hi,
Greetings!
My application uses MFC document view architecture and it is an MDI Application.
When right clicked on the MDI child it creates and display another MDI Child window.
The newly created child window is displayed correctly but the previous background MDI child window also gets resized.
I think its window default behaviour to send the OnSize() message to all the MDI Child windows, whenever one of the MDI Child is created or
resized.
[To demonstrate easily this behavior open two files in VC++ IDE and Maximized them, now if the upper files is resized using min/max button
the second file is also gets resized.]
I don't want to resize the first MDI window (it's size should remain unchanged) if other MDI child window is created.
I found that MDIChild window receives WM_SIZING,
WM_SIZE & WM_GETMINMAXINFO.
The problem is that window sends these messages multiple times.
Till now I am trying to avoid the sizing using a flag; as I need to keep the previous MDIChil window Maximum I am using ShowWindow(...)
It does remain maximized but the MIN/MAX button
disappears.
This I think most likely because of multiple messages.
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
if(m_bShowMax)
{
ShowWindow(SW_SHOWMAXIMIZED);
m_bShowMax = false;
}
}
Any idea about how to achieve it will be very helpful.
Regards,
Prashant
|
|
|
|
|
ok this is the deal. I've been making them little proggies lately ( alot of them, you know those address-book like things all based on file writing and lists) but i came to noticing that my computer was going slower and slower the longer it was on and i even had to reboot after a while cause i couldn't do anything anymore. I downloaded one of those ram-freeing proggies and that solved it, it came to the conclusion my memory was running out and i had to free it manually over and over again. So i thought "goddarnit, this doesn't have anything to do with my proggies i hope, maybe i got some memory-eating coding in there". So this is what i'm asking: If you consider yourself a good programmer, download the source of one of my proggies (given the link below) and take a look at it and PLEASE tell me if there's some kind of memory problem in it! I know the coding is pretty messy but that doesn't matter. I would also like to know if anyone else experienced this problem before.
(BTW the memory eating continues even after i shut them down so i'm not sure if its my proggies)
Link to source code: http://www.geocities.com/spidyvshades/IPlog.zip
AÐios
Kuniva
|
|
|
|
|
In Visual Studio, you can get some elementary memory leak tracking using your Debug build. When you finish running your program in the debugger, check out the "Debug" output window. At the bottom, if you have memory leaks, it should spew out a whole pile of stuff looking like:
Detected memory leaks!
Dumping objects ->
{23103} normal block at 0x017C96D0, 36 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{23102} normal block at 0x017C97B0, 216 bytes long.
Data: < > FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00
Object dump complete.
That means you've got memory leaks. To find out where they're occurring, you can double-click on them and Visual Studio *may* take you to the "new" statement that caused the problem. If not, I recommend you to a search on _crtBreakAlloc for a bit more info on how to track down the problems.
Other than that, if you're willing to pay money (and quite a bit, I think) you can use BoundsChecker (just search CP for it - it gets mentioned all the time).
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
ah, thank you for the help
Kuniva
|
|
|
|
|
I am trying to create a MFC dialog app that has a small amout of DX but I don't really know Win32 that well and all the examples are in win32 SDI window. Does anyone have any examples?
-Matt Newman
-Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|