|
I want to save/restore size and position of midi-child-frames.
The size is OK, but position seems to have an offset of mainframes toolbar,menu and border.
I use Get/SetWindowRect().
Any idea?
|
|
|
|
|
Have you tried Get/SetWindowPlacement() ?
Dave
|
|
|
|
|
|
I am having trouble killing my timer. It crashs everytime it is killed with an assertion that checks hWnd. The real problem is that the timerID passed to OnTimer is bad.
SetTimer returns the correct timerId which I set to 255. OnTimer gets something like 6603033, and the number is always the same. If, inside OnTimer, I use KillTimer(6603033), it works. I suspect this number may change however....and I don't know where this # comes from?
I am using CBitmapButtons and I noticed someone else has a similar problem on here. When they added a CBitmapButton, their OnTimer() fails to get called at all.
Any suggestions?
Thanks
|
|
|
|
|
Which value are you passing as the parameter to KillTimer()?
The return value from SetTimer() or the nIDEvent parameter
from the SetTimer() call ?
The doc seems to imply the return value, but the argument list defintions seem to imply the nIDEvent. (see below)
UINT SetTimer( UINT nIDEvent, UINT nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT, UINT, DWORD) );
BOOL KillTimer( int nIDEvent );
I have used the SetTimer(), KillTimer() a lot, and I have
been passing the nIDEvent to KillTimer() ...
Example :
int timerResult = SetTimer(1,500,NULL);
KillTimer(1);
|
|
|
|
|
Things to check:
1. Is the timerid you supply for SetTimer a variable?
If yes, check your program to see it doesn't get changed somewhere. I typically "define" them
For instance:
#define TIMER_ID 1
#define TIMER_TIME 1000
#define TIMER_ID_DIS 2
#define TIMER_TIME_DIS 60000
Then in my OnTimer message i check for TIMER_ID & TIMER_ID_DIS
2. Are you forwarding the timer message to another window?
That might (not sure) it to be different.
3.>> It crashs everytime it is killed with an assertion >>that checks hWnd.
That might suggest that the window(CWnd, CButton, everthing derived from CWnd/CWindow) is already destroyed.
If you are trying to kill your timer in the destructor of your window, don't!!! Destroy it in an OnClose or something but not in a destructor because the m_hWnd is already invalid then.
In none of these is the case, show us the important parts of the code.
Benedict Verheyen
|
|
|
|
|
How do you programmatically crop a bitmap (CBitmap DIB) image in vc++6?
For example, say I have a bitmap image with dimensions 100x100. I want to create a new bitmap with just the 10x10 image in the very center of the original bitmap. How do I do so?
Phil
|
|
|
|
|
How do I prevent the NEW Dialog box from coming up when I add a new view to a SDI app
|
|
|
|
|
I need some help with these API calls:
My GetExitCodeProcess() function is failing...
The exception window displays:
"unhandled exception in Bond.exe [Kernal32.dll]
0xC000005, Access Violation
Can anyone tell me what might be wrong with
the following code, is it my handle?
HWND hWnd = ::FindWindow("XLMAIN", NULL);
DWORD pid; //variable to hold the process ID.
DWORD dThread; // Variable to hold (unused) thread ID
dThread = GetWindowThreadProcessId(hWnd,//Handle to window
&pid);// Address of process ID
HANDLE hProcess; //Handle to existing process
//PROCESS_ALL_ACCESS Specifies all possible access flags for the process object.
//PROCESS_QUERY_INFORMATION Enables using the process
//handle in the GetExitCodeProcess and GetPriorityClass //functions to
//read information from the process object.
//SYNCHRONIZE Windows NT/2000: Enables using the process //handle in any //of the wait functions to wait for the //process to terminate.
LPDWORD lpExitCode = 0;
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE,
pid);
// the following statement cause an access violation:
//"unhandled exception in Bond.exe [Kernal32.dll]
//0xC000005, Access Violation
//why? please help.
BOOL bResult = GetExitCodeProcess(hProcess, lpExitCode);
|
|
|
|
|
DWORD &exitCode = 0;//<-- this line
hProcess = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE,
pid);
// the following statement cause an access violation:
//"unhandled exception in Bond.exe [Kernal32.dll]
//0xC000005, Access Violation
//why? please help.
BOOL bResult = GetExitCodeProcess(hProcess, &exitCode); //<-- this line
|
|
|
|
|
I know this is kinda stupid question, but say I load a picture, but I want it to be able to change bitmap while I work with the program, MSDN I think get the following two explenations:
Syntax
Control.Picture[ = cFileName ]
Settings
cFileName
Specifies a .bmp, .gif, .jpg or, .ico file.
And:
object.Picture [= picture]
The parts of the Picture property syntaxes are described in the following table.
Part Description
picture A string expression specifying a file containing a graphic, as described in Settings.
Settings
The settings for picture are described in the following table.
Setting Description
(None) (Default) No picture.
Bitmap Specifies a graphic. You can load the graphic from the Properties window at design time. At run time, you can also set this property using the file name of a bitmap.
So lets say I have a picture with the string m_SelBmp
And a bitmap with ID: IDB_BMP
Should I call like this:
dunno.m_SelBmp[ = IDB_BMP ]
The funny thing here is that I know API much better than MFC...
|
|
|
|
|
I am creating a dialog based application using ATL. I want to minimize the size and and remove dependencies on MFC. All was well until I attempted to insert an ActiveX control using the Project/Add to Project/Components and Controls method commonly used. The problem is the control added by that method generates wrapper classes based on CWnd which the ATL project does not understand. I can also add an activeX control by right clicking on the resource form but no wrapper classes are generated. So my question is what is the simplest way to add an ActiveX control to the ATL based application? Will I need to use smart pointers/or IDL paths, etc, to access the ActiveX object like any other COM object?
|
|
|
|
|
Environment: Windows 9X, NT, 2000 VC++ 6.0
Can anyone tell me how CRichEditCtrl allocates memory? Is it movable or non-movable. I can't seem to find anything on the MSDN site. I'm trying to develop a real-time machine tool controler, and can't afford the latency that would be imposed by a virtual memory swap. I need to have the entire file (which is potentially quite large) in physical memory, assuming that there is enough physical memory to support this. Any help would be greatly appreciated.
|
|
|
|
|
Hi!
Is it possible to send dynamically generated text to a CHTMLView ?
Thank you,
Alwin
|
|
|
|
|
Hello everyone,
Can somebody help me with changing the font of menubar text in Visual C++?
Thanks alot,
Jeff
|
|
|
|
|
Check out http://www.codeproject.com/menu/bcmenu.asp for an owner drawn menu solution. This may be a good starting point.
|
|
|
|
|
I have picture in array of pixels (8 bit gray) I know width and hight of picture and position of pixels in picture .I would like to transfer this 8 bit value to some buffer and in one moment to show the picture on the screen(window).I would like to have this code so fast as possible.
Can someone help me?
Thank you.
|
|
|
|
|
Lookup the Windows GDI BitBlt function (there's a CDC version too). This will draw a bitmap onto a destination device at high speed.
Dave
|
|
|
|
|
Hi.
I want to know ho to get desktop's icons positions and labels.
if i use ListView_GetItemPosition(hwnd,i,&pt);
explorer crashes.
hwnd - desktop listview's handle
|
|
|
|
|
I am trying to make a backup program, but I keep running into a problem with the file sharing settings. The problem is: when a file is already open and has its share settings set to deny read or read/write access. I only need to copy the contents of the file, not modify it. I have tried using CopyFile and a file copy algorithm of my own to no avail. I always make sure to open the file as read-only. Is there a way to get around the file sharing settings? Or another idea to achieve the same effect? Somehow other backup programs get around this. Thanks.
|
|
|
|
|
Hello!
Someone knows if there is a function for drawing a line in a Consolse Appliction?
Thank you,
Asaf.
|
|
|
|
|
What sort of a line?
The console is a character-based device, so any line drawing will involve outputting characters.
|
|
|
|
|
Hi
I'm looking for a report writer to create reports generated from arrays and other nonpersistent data sources using Visual C++ 6. Does anyone have any suggestions?
Thanks.
Per
|
|
|
|
|
You can use XML datasource and XSLT stylesheets to produce DHTML reports. MSXML parser is included in IE5 and can be used with C++ code with the #import <msxml.dll> directive.
Look at the Web Services in Platform SDK.
|
|
|
|
|
Hi,
I'm looking for a tool which would generate the call graph for the entire module ie. across the projects in visual c++. Is there any tool available.
A typical situation could be a maintenance project which requires tracing function calls, which calls which etc.
Any info. would be appreciated.
Thank You
Bye
Kannan
|
|
|
|