|
I used WM_PRINT. This gives me the bitmap of all controls in the form, but the form area appears black?
|
|
|
|
|
dear all,
i want to develop an application which is executed only through command line.
i don't want the application to be executed if someone double clicks on it. how do i implement this idea.
rIsHaBH
|
|
|
|
|
I you need some arguments, you can check the CommandLine at the begining of your program, and if it's empty, you can exit the program.
Hope this help
|
|
|
|
|
hi cedric
i want my app not to be executed if someone doubleclicks on it.
if i set the command line parameter in the properties
(eg. C:\winamp.exe "Here I am.mp3") of the exe file, then it will get executed on dbl click....which i don't want.
any clues!
rIsHaBH
|
|
|
|
|
You cannot avoid your app to be executed when a user double-clicks on it. But what you can do is what cedric did suggest, that is exit from your app before anything happens by checking for an empty command line. To the user, this will appear "as if" your app had not be launched. Of course, if your app has a command line, it will work normally.
~RaGE();
|
|
|
|
|
If you make one of the command line arguments secret then noone will know how to edit the shortcut to include the command line option.
I'm going to live forever or die trying!
|
|
|
|
|
If you make one of the command line arguments secret then noone will know how to edit the shortcut to include the command line option.
I'm going to live forever or die trying!
|
|
|
|
|
Hi All,
I need to read and display a raw image of size 134 * 104
using MFC application in Visual C++.the image to be loaded and displayed must have a *.raw extension.
How i want to change the *.raw to *.bmp
can anyone help me out.
Thanks
:_Rocket_:
|
|
|
|
|
I don't have the answer how to convert from raw to bmp but there is more information needed. What format is the raw data in? There are very many formats. Is it color or grayscale?
John
|
|
|
|
|
the file in pixel and it is grayscale
:_Rocket_:
|
|
|
|
|
I assume that 1 pixel is 8 bits, so there are 256 different sades of gray.
John
|
|
|
|
|
Hi, I want to mark items on a popup menu as checked or unchecked. Here is the code I am trying to use.
CMenu menuPopup;<br />
<br />
menuPopup.LoadMenu(IDR_MENU_ZOOM);<br />
menuPopup.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN,point.x,point.y,this);<br />
menuPopup.CheckMenuItem(1, MF_CHECKED|MF_BYPOSITION);
The problem is that when I call CheckMenuItem nothing happens, and if I look at the returned value from CheckMenuItem it is 0xFFFFFFFF which means 'the menu item did not exist'.
What am I doing wrong?
Is there a better way?
Thanks, (bleary eyed on a Monday morning)
Ali
|
|
|
|
|
Does the MAIN menu have two items?
Are you trying to
menuPopup.GetSubMenu(0)->CheckMenuItem(1, MF_CHECKED|MF_BYPOSITION); ?
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Hi Peter,
Thanks for the reply, I've just found a solution. I was trying to use the position to select the item (MF_BYPOSITION) thinking I couldn't get that wrong! But I've changed it to use the command (MF_BYCOMMAND) and now it works. Thats great, although I am still curious as to why it didn't work with the position.
Just to answer your question no, its not in Main, its in the 'view'. I'm generating context sensitive popup menus in the view class, using ON_WM_CONTEXT_MENU as a trigger, then I select and load the appropriate popup menu.
Thanks for answering, if you have any comments on what I am doing let me know. I'm only a 'part time' programmer so even when I get things working I'm not always confident that I have done it the best way.
Cheers, Ali.
Ali
|
|
|
|
|
The TrackPopupMenu is a modal call. The function returns after the menu has been dismissed. Therefore, you should do all setup/configuration prior to calling TrackPopupMenu.
onwards and upwards...
|
|
|
|
|
Interesting. Use a pointer to the submenu.
CMenu *pSubMenu = menuPopup.GetSubMenu(0);
pSubMenu->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
pSubMenu->CheckMenuItem(1, MF_CHECKED | MF_BYPOSITION);
Kuphryn
|
|
|
|
|
I want to find an ActiveX control which can load jpeg/bmp/tif file and display on UI on the fly.
Anybody know this?
Software Engineer
Xilin
|
|
|
|
|
|
Yes, I have to use an ActiveX control. CxImage Class is helpless for me.
Thanks
Software Engineer
Xilin
|
|
|
|
|
Couldn't you wrap it in an OCX?
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I decided to try out some of the new features in VS studio NET 2003.
One of these is the /RTCs switch, which does overrun and underrun checking of all multi-byte local variables such as arrays.
However I found that it only works half the time, for instance this code fails to give me any error:
int test[2];
test[3] = 1;
but this code will cause the run type check:
char test[2];
test[3] = 1;
Anyone use this feature? Anyone know why it doesn't work properly?
thanks in advance,
Ed
|
|
|
|
|
Ah ****, I didn't bring my Debugging Applications for Microsoft.NET and Microsoft Windows[^] in to work today.
Robbins definitely covers this subject in this book. Recommended read for all C++ and .NET developers (which is basically everyone!)
I think the answer is just coincidence: you may have overwritten that location with a value that it still considers valid, or it might be something to do with padding (?)
--
Mike Dimmick
|
|
|
|
|
Yes, I think this feature works by putting special bytes at the beginning and end of each array and then checking at the end of the program if these bytes were overwritten.
But for whatever reason it only seems to work about one in ten times. I tried changing the padding and it doesn't make any difference.
It's a pity because it would be a nice feature.
|
|
|
|
|
I cheated; I looked at the compiled code (use the /FAcs option, or set Configuration Properties > C/C++ > Output Files > Assembler Output to Assembly, Machine Code and Source in the project Properties box).
The compiler allocates 200 bytes more on the stack than the routine actually needs when /RTC1 (the combination of /RTCs and /RTCu) is enabled, rounded up to the nearest multiple of 4. The allocated region is then filled with 0xcc (the reason for the multiple of 4 is so that the compiler can use a simple fill-memory instruction).
However, for some reason, the compiled code starts using locals at the normal point, e.g. in your first example, test[0] is at ebp-12 (the frame pointer is stored in the ebp register, and the stack grows down in memory). The allocated space is great for underruns, poor for overruns.
As such, when the compiler compiles test[3] = 1 , it generates code to modify the value of [ebp]. This location is where the called function stores the value of the previous function's frame pointer: an area which isn't checked by the /RTCs option. This explains why my test compilation blows up in main() , with the following error:
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
It's not an exact science, this.
I do think the compiler's doing something odd: it's difficult to trap buffer overruns if the buffers are being allocated this close to the danger area (of previous frame pointer and return address). The other odd thing it's doing is generating clearly incorrect code!
Oddly, the default compiler options for a Debug build don't include the /GS (Buffer Security Check) switch. This stores an XOR of the return address with a generated 'security cookie' elsewhere in the function's stack frame; at the end of the function, the return address and cookie are compared, and a runtime error occurs if they don't match. However, the documentation states that this occurs "on functions that the compiler thinks might be subject to buffer overrun problems" - in other words, according to an undocumented heuristic.
Robbins recommends enabling /GS even in your Debug build.
--
Mike Dimmick
|
|
|
|
|
Thanks for the info. Looking at it more closely now, I think that the buffer checking only checks the word immediately after the end of the array. If I set test[2] = 0; it does trigger the buffer overrrun warning.
|
|
|
|