|
There's a bunch of things wrong there
First you NEVER use a CPaintDC except in response to
WM_PAINT (in OnPaint()). A CPaintDC is not valid in
any other place.
Second, I can't tell how you're trying to create the bitmap,
but your calls are out of order. I'm not even sure how to correct
it without knowing what you want the bitmap to be.
Third, there's no code shown that has anything to do with
setting a picture control's bitmap, which I thought was the
original problem.
What are you trying to do?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello All !
I wish to hide (not display) the GUI of an MFC Dialog Based application on first run.
When I use ShowWindow(SW_HIDE) inside OnInitialDialog() it doesn't seem to work.
What should I do ?
|
|
|
|
|
The reason is, because as stated by the documentation on MSDN, OnInitDialog() is sent to the dialog box during the Create, CreateIndirect, or DoModal calls, which occur immediately before the dialog box is displayed, therefore if you call ShowWindow(SW_HIDE) then the window will be shown after OnInitDialog() returns.
To solve this you should create your dialog without the WS_VISIBLE style.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
OK.
But where do I turn off the WS_VISIBLE flag ?
Since it is a Dialog application there is no PreCreateWindow message.
When I try to overwrite the structure in the OnCreate() it seems that it is already turned off.
Should do it through OnInitialDialog() ?
Or elsewhere ?
Thanks,
Amit
|
|
|
|
|
Is your dialog created from a resource?
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
No, I used Visual Studio 6.0 Wizard to create a standard Dialog based application.
According to what Hamid answered it seems that there is no elegant way to do this, and the solution is to go around it...
Amit C.
|
|
|
|
|
You can make a little program for show it you must be use of FindWindow or EnumWindow for get a handle to your window of your program and then use of ShowWindow(SW_SHOW).
|
|
|
|
|
AmitCohen222 wrote: I wish to hide (not display) the GUI of an MFC Dialog Based application on first run.
See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi all,
I am developing a portable system and want to be able to change the IP address of the PC from my application. I am using VC6, does anyone have any ideas of how to do this?
Cheers
Jim
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hello!
I have repetitive problem in the program execution like this:
###############################################################
HEAP[at6023ax_debug.exe]: HEAP: Free Heap block 1f8cbd8 modified at 1f8cc5c after it was freed
Windows has triggered a breakpoint in at6023ax_debug.exe.
This may be due to a corruption of the heap, and indicates a bug in at6023ax_debug.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
###############################################################
The problem is I can't step by step debug it as it happens in asynchronous call. The problematic memory location presented in the output window is always different when I restart the application. Is there a way to tell the debugger that when I start the application the memory mapping is always the same? I mean that every heap and stack variable will get the same virtual memory address as it had in the previous program run? This way I could set the break point on the exact memory address and I could see which threads are accessing and changing that memory location or at least see which variable is stored on that location before every thing goes haywire.
Best regards,
Marko Kukovec
|
|
|
|
|
Are you passing to the asynchronous call a local variable
(or a pointer to one) which is going out of scope before the
call tries to use it?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This code is not mine and I inherited it. I have no clue where the problem is. All I know is I can repeat the problem and that the place debugger reports (code line where it breaks the code is not always the same) does not have any sense. So only real data is a memory location where the problem occurred. The problem is that this location is not the same when I restart the program and I cannot set the break point on that same memory location to see all the places that access or modify this memory location.
Marko
Rostfrei
|
|
|
|
|
What about the call stack at the time it crashes?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everyone,
In ATL wizard (I am using VS 2008) when add a new ATL object, we can assign 4 names,
1. Short Name (under C++ sub-category);
2. Class Name (under C++ sub-category);
3. CoClass Name (under COM sub-category);
4. Interface Name (under COM sub-category);
My question is how they are binded/related together? My current understanding is (please feel free to correct and add more points),
- From COM client point of view, it only knows 3 and 4 when create the class (it knows nothing about real C++ class name defined in 2), and in the template code generated by ATL, 3 and 4 are binded to 2. Am I correct? But how it is binded?
- What is the usage of 1 (Short Name)?
- I always use C++ and always using class/interface GUID other than names defined in 3 and 4 to create instance and access interface, in what scenarios will names defined in 3 and 4 be used and how they are translated/binded into GUID?
thanks in advance,
George
|
|
|
|
|
i have something like this
BYTE aby1 [3] = { 0x12, 0x13, 0x1F};
BYTE aby2 [3] = { 0x21, 0x23, 0x2F};
BYTE * pby1;
pby1 = (BYTE *) malloc (sizeof (256));
pby1 = aby1;
now at the end of pby1 i want to add the elements of aby2 ?
|
|
|
|
|
By judging from the subject line in your post as well as browsing through some of your previous posts it's clear that you have not grasped the concept of Dynamic_memory_allocation[^].
The code snippet you provided doesn't do what you think it does; e.g. you have an obvious "memory leak" since you allocate memory and then let the pointer point to the buffer on the stack. The size of the memory leak is depending on how many bytes the compiler thinks it would take to store the integer 256 .
I strongly advise you to read this[^]!
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
hi i have written the bellow code to search the bluetooth device.
<code>
#include <windows.h>
#include <stdio.h>
#include <bthdef.h>
#include <bthsdpdef.h>
#include <BluetoothAPIs.h>
int main()
{
BLUETOOTH_DEVICE_SEARCH_PARAMS BluetoothSearchParams;
BLUETOOTH_DEVICE_INFO BluetoothDeviceInfo;
HBLUETOOTH_DEVICE_FIND hBluetoothDevice;
ZeroMemory(&BluetoothSearchParams, sizeof(BluetoothSearchParams));
ZeroMemory(&BluetoothDeviceInfo, sizeof(BluetoothDeviceInfo));
BluetoothSearchParams.dwSize = sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS);
BluetoothSearchParams.fReturnAuthenticated= true;
BluetoothSearchParams.fReturnRemembered = true;
BluetoothSearchParams.fReturnUnknown = true;
BluetoothSearchParams.fReturnConnected = true;
BluetoothSearchParams.fIssueInquiry = true;
BluetoothSearchParams.cTimeoutMultiplier = 15;
BluetoothSearchParams.hRadio = NULL;
BluetoothDeviceInfo.dwSize = sizeof(BluetoothDeviceInfo);
hBluetoothDevice = BluetoothFindFirstDevice(&BluetoothSearchParams,
&BluetoothDeviceInfo);
if (hBluetoothDevice != NULL)
{
while (true)
{
wprintf(L"Found a Bluetooth device!\n");
if (BluetoothFindNextDevice(hBluetoothDevice,
&BluetoothDeviceInfo) == false)
{
break;
}
}
}
else
{
wprintf(L"Unable to find a Bluetooth device.\n");
}
return 0;
}
</code>
i have created new win32console project and written the above file i have sdk installed but while compiling it shows that files like bthdef.h & BluetoothAPIs.h & bthsdpdef.h not found....
how to set the project properties so that i can link the files form my sdk folder...
|
|
|
|
|
Did you specify the name of the library in linker settings?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
yes i have set the additional libraries to my sdk path but even then it is same.
|
|
|
|
|
It's not a linker problem. The compiler is complaining about not finding .h files
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
manju23reddy wrote: how to set the project properties so that i can link the files form my sdk folder...
What version of VS are you using? With VS2005, click Options from the Tools menu. Open Projects and Solutions, and select VC++ Directories.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Suppose I declare a static variable in a dll, and simultaneously launch two applications which use the same dll. Now if I change the value of that static variable from one application, will the other application will be affected by this?
Specifically, will Singletons will behave properly if I declare them in a dll?
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|
|
The NULL Developer wrote: Now if I change the value of that static variable from one application, will the other application will be affected by this?
No, because when a DLL is loaded by a process, it is loaded into the address space of the calling process, creating a copy of the module, which means the data in the DLL used by one process will be separated from the data in the DLL used by the other process.
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
Thanks Perspx, exactly what I had expected.
"Do first things first, and second things not at all."
— Peter Drucker.
|
|
|
|