|
Steve The Plant wrote:
I'm having a bit of trouble debugging it because a) the module (a homebrew.dll) that seems to cause the message doesn't open files
Huh, doesn't open files? You need to have the source files so you can fix the memory leak. You should be able to go to line 531 of that file and see where the memory was allocated that you didn't free.
Regards,
Alvaro
|
|
|
|
|
I understand the error a little more. The "#File Error#"
part of the message means that it can't find the
file the error occurs in, so instead of the filename it
gives #File Error#.
So, it knows there's a memory leak and it knows at what line
it happens, but it doesn't know which file. Ugh.
I'll investigate some more.
Steve The Plant
|
|
|
|
|
At first I thought this wasn't a problem at all. But now that I started an OpenGL-MFC based solution, all of a sudden I fail at even attempting to make this MFC app go full screen.
I searched allot of sites over this 'issue', but I was really amazed by not finding any info on this. I only run into this problem using MFC.
My rather silly simple problem is, how to make an MFC app go full screen? And I really mean fullscreen.
Thanks for any help.
|
|
|
|
|
I don't know OpenGL, and i think OpenGL have a function for screen !
Anyway, you can use GetDeviceCaps for getting display coordinate and resize your program window to full screen !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Have a look at Q164162 in the knowledge base. It works for me.
|
|
|
|
|
Yes this does work. Although... it's not exactly a common known solution (if there is one) But it does work. Only problem left is that in XP I still have the window borders showing up.
I 'solved' this by making the 'rectDesktop' 2 pixels larger. Hopefully that works on any desktop theme. Else I need to know a way to get the current border width.
Thanks for your help, it helped allot.
|
|
|
|
|
I've been doing either this (in InitDialog)
[ccode]
BOOL returnCode = SetWindowPos( this->GetActiveWindow(), 0, 0, ::GetSystemMetrics(SM_CXMAXIMIZED), ::GetSystemMetrics(SM_CYMAXIMIZED), SWP_SHOWWINDOW);
[/ccode]
or this:
[ccode]
CRect rect;
rect.top = 0;
rect.left = 0;
rect.right = ::GetSystemMetrics(SM_CXMAXIMIZED);
rect.bottom = ::GetSystemMetrics(SM_CXMAXIMIZED);
this->GetActiveWindow()->MoveWindow(rect,TRUE);
[/ccode]
If you do anything with OnSize, remember that it is called twice - once before InitDialog, and then again after InitDialog, and you can't move controls until InitDialog runs because they don't exit yet. (you didn't ask this, and I think I'm telling it correctly. You might also be interested in the EasySize class for moving dialog controls around as you resize a dialog - it is very helpful. (search this site if you are interested)
|
|
|
|
|
Still, using both this and the solution 2 posts back, I get thin borders around the screen. A simple way to get the current border width would solve this.
...and this post got me to look up 'GetSystemMetrics'
again, and ::GetSystemMetrics(SM_CXBORDER), ::GetSystemMetrics(SM_CYBORDER) both do the trick I needed.
i.e. it all works now!
thanks
Long live..... MFC?
|
|
|
|
|
Dir forum,
I am a beginner in ATL, WTL, and COM. I want to write a WTL a program like IE. And I found a article in Codeproject. It is "Using WTL's Built-in Dialog Resizing Class" by Michael Dunn. I like his articles very much! But I don't know how to capture IE event like OnDocumentComplete and others, to disable and enable some key like Stop, Back, Forward ...
If you have another project to demo. Please show it to me!
Thank you very much!
|
|
|
|
|
Can YOU explain EnumChildWindows(...) function to me!?
I want to get the window handle of a button using this... is it possible...
Nish [BusterBoy] You told me to use this function, but can you tell me how to use it?!?!?!?! :
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Did you try typing EnumChildWindows and hitting F1 or otherwise checking MSDN?
Here's what MSDN has to say:
Creating, Enumerating, and Sizing Child Windows
You can divide a window's client area into different functional areas by using child windows. Creating a child window is like creating a main window — you use the CreateWindowEx function. To create a window of an application-defined window class, you must register the window class and provide a window procedure before creating the child window. You must give the child window the WS_CHILD style and specify a parent window for the child window when you create it.
The following example divides the client area of an application's main window into three functional areas by creating three child windows of equal size. Each child window is the same height as the main window's client area, but each is one-third its width. The main window creates the child windows in response to the WM_CREATE message, which the main window receives during its own window-creation process. Because each child window has the WS_BORDER style, each has a thin line border. Also, because the WS_VISIBLE style is not specified, each child window is initially hidden. Notice also that each child window is assigned a child-window identifier.
The main window sizes and positions the child windows in response to the WM_SIZE message, which the main window receives when its size changes. In response to WM_SIZE, the main window retrieves the dimensions of its client area by using the GetWindowRect function and then passes the dimensions to the EnumChildWindows function. EnumChildWindows passes the handle to each child window, in turn, to the application-defined EnumChildProc callback function. This function sizes and positions each child window by calling the MoveWindow function; the size and position are based on the dimensions of the main window's client area and the identifier of the child window. Afterward, EnumChildProc calls the ShowWindow function to make the window visible.
#define ID_FIRSTCHILD 100
#define ID_SECONDCHILD 101
#define ID_THIRDCHILD 102
LONG APIENTRY MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
RECT rcClient;
int i;
switch(uMsg)
{
case WM_CREATE:
for (i = 0; i < 3; i++)
{
CreateWindowEx(
0,
"ChildWClass",
(LPCTSTR) NULL,
WS_CHILD | WS_BORDER,
0,0,0,0,
hwnd,
(HMENU) (int) (ID_FIRSTCHILD + i),
hinst,
NULL);
}
return 0;
case WM_SIZE:
GetClientRect(hwnd, &rcClient);
EnumChildWindows(hwnd, EnumChildProc,
(LPARAM) &rcClient);
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
{
LPRECT rcParent;
int i, idChild;
idChild = GetWindowLong(hwndChild, GWL_ID);
if (idChild == ID_FIRSTCHILD)
i = 0;
else if (idChild == ID_SECONDCHILD)
i = 1;
else
i = 2;
rcParent = (LPRECT) lParam;
MoveWindow(hwndChild,
(rcParent->right / 3) * i,
0,
rcParent->right / 3,
rcParent->bottom,
TRUE);
ShowWindow(hwndChild, SW_SHOW);
return TRUE;
}
Hope this helps,
Bill
|
|
|
|
|
Hi, all ! ! !
--------
This function should draw the HBITMAP (m_hPicUp) to the Device Context (hdc).
The function also use another HBITMAP (m_hPicMask) as a mask for drawing.
Now, the problem is that it only works on the first time .
Every WM_PAINT, I call this function.
and it draws normally only at the first WM_PAINT.
Please tell me why.
void DrawIt ( HDC hdc)
{
<code>RECT</code> r;
::GetClientRect( m_hWnd, &r);
if(!m_hPicUp) return;
<code>int</code> cx=r.right - r.left;
<code>int</code> cy=r.bottom - r.top;
<code>HDC</code> hdcBmp= CreateCompatibleDC(hdc);
<code>HBITMAP</code> hOldBmp= (<code>HBITMAP</code>)SelectObject(hdcBmp, m_hPicUp);
<code>HDC</code> hdcMask= CreateCompatibleDC(hdc);
<code>HBITMAP</code> hOldMsk= (<code>HBITMAP</code>)SelectObject(hdcMask, m_hPicMask);
<code>HDC</code> hdcMem= CreateCompatibleDC(hdc);
<code>HBITMAP</code> hBitmap;
hBitmap= CreateCompatibleBitmap(hdc,cx,cy);
<code>HBITMAP</code> hOldMem= (<code>HBITMAP</code>)SelectObject(hdcMem, hBitmap);
BitBlt(hdcMem, r.left,r.top,cx,cy,hdc,0,0,SRCCOPY);
BitBlt(hdcMem, r.left,r.top,cx,cy,hdcBmp,0,0,SRCINVERT);
BitBlt(hdcMem, r.left,r.top,cx,cy,hdcMask,0,0,SRCAND);
BitBlt(hdcMem, r.left,r.top,cx,cy,hdcBmp,0,0,SRCINVERT);
BitBlt(hdc, r.left,r.top,cx,cy,hdcMem,0,0,SRCCOPY);
DeleteObject(SelectObject(hdcBmp, hOldBmp));
DeleteObject(SelectObject(hdcMask, hOldMsk));
DeleteObject(SelectObject(hdcMem, hOldMem));
DeleteObject(hBitmap);
DeleteDC(hdcMem);
DeleteDC(hdcMask);
DeleteDC(hdcBmp);
}
I copied that code from CxSkinButton::DrawBitmap(...) and changed it to NOT MFC.
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
Seems like these three lines
DeleteObject(SelectObject(hdcBmp, hOldBmp));
DeleteObject(SelectObject(hdcMask, hOldMsk));
DeleteObject(SelectObject(hdcMem, hOldMem));
should be instead like this:
SelectObject(hdcBmp, hOldBmp);
SelectObject(hdcMask, hOldMsk);
SelectObject(hdcMem, hOldMem);
Otherwise you'd be deleting m_hPicUp and m_hPicMask , and deleting twice hBitmap (here and in the subsequent line).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you for your quick answer.
It works .
Thank u very much.
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
Hi,
I have a MFC based DLL which I have been trying to convert to plain Win32. I have created a new WIN32 DLL project, added in my files, substituted the MFC classes for Win32 versions and rebuilt the DLL.
Alas, link errors.
Linking...
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyDll.obj
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyDll.obj; second definition ignored
Creating library Debug/MyDll.lib and object Debug/MyDll.exp
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
c:\progra~1\winamp\plugins\MyDll.dll : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
I found the following knowledge base article which should fix it but it doesn't.
Anyone else help?
James Spibey
I love the word naked, it's brilliant isn't it, 'naked'. When I was a kid I used to write the word naked on a bit of paper hundreds of times and rub my face in it - Jeff, Coupling, BBC2
|
|
|
|
|
nafxcwd.lib is the static version of MFC debug library. This is probably being linked with a
#pragma comment(lib, "nafxcwd.lib") directive located in MFC header afx.h, so my guess is that you should try to locate an offending
#include<afx.h> somewhere in your code and delete it (as you're trying to get rid of MFC, right?). Look in stdafx.h, a very usual place for this kind of include s.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Figured it out eventually after your suggestion. The <ForceLib.h> file which Q148652 suggests to create, includes a section at the beginning which links in the nafxcwd.lib files etc. When I removed this and linked in a few other WIN32 libs, it finally worked.
Thanks for your help.
James Spibey
I love the word naked, it's brilliant isn't it, 'naked'. When I was a kid I used to write the word naked on a bit of paper hundreds of times and rub my face in it - Jeff, Coupling, BBC2
|
|
|
|
|
Hi All,
How can I change the Background color of teh client area of a window with out using any Brush.
Thanks in Advance
Sangeetha
|
|
|
|
|
If you want to channge it in your main dialog just put SetDialogBkColor(background, control); in Initinstance();. background is the background color, control is the color of the text you put on the dialog.... and other controls i think, try it and mix with it!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
I use smart pointers to encapsulate interfaces.
It is possible to get CLSID string from interface encapsulated in smart pointer ???
|
|
|
|
|
I have used this
USES_CONVERSION;
if(pModule != NULL)
{
LPOLESTR lpModuleCLSID;
StringFromIID(pModule.GetIID(), &lpModuleCLSID);
CString sModuleCLSID = OLE2T(lpModuleCLSID);
CoTaskMemFree( lpModuleCLSID );
}
pModule is smart pointer (_com_ptr_t) IModulePtr pModule;
I inilialize it like this:
pModule.CreateInstance(sGuid)
where sGuid is an identifier of class that implements IModule interface.
In presented sample code I've got the string identifier of IModule interface, not sGuid.
How to get string ID from class (interface) that implements IModule interface ?
|
|
|
|
|
Unless the interface has a method to return the CLSID, it can't be done.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Hi,
I want to develop for the Palm OS ( I have a Palm Vx), I read there is a DLL or whatever that allows you to write your code in Visual C++, is that true ?
How can I get something free and good to program the Palm ?
Thanks, Bye !
Braulio
|
|
|
|
|
download the Palm SDK and an emulator
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Thanks,
And one question more..., how hard is it to get results ?, Or can be done simple applications ? ( is so hard as Windows raw C programming ?)
Bye !
Braulio
|
|
|
|
|