|
You mean capturing OnContextMenu over an image ? YOu need to catch it in the control showing the picture, or if showing a picture is all you are doing, draw it yourself and check if your mouse is over it when you catch OnContextMenu in the parent window.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
hi can anyone explain to me how the sample code below (which shows a screen capture) works? I mean can anyone read the code below and explain in detail how this code works . Thanks a million for helping.
sample code
// Create a copy of the current system palette.
HPALETTE GetSystemPalette()
{
HDC hDC;
HPALETTE hPal;
HANDLE hLogPal;
LPLOGPALETTE lpLogPal;
// Get a DC for the desktop.
hDC = GetDC(NULL);
// Check to see if you are a running in a palette-based video mode.
if (!(GetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)) {
ReleaseDC(NULL, hDC);
return NULL;
}
// Allocate memory for the palette.
lpLogPal = GlobalAlloc(GPTR, sizeof(LOGPALETTE) + 256 *
sizeof(PALETTEENTRY));
if (!hLogPal)
return NULL;
// Initialize.
lpLogPal->palVersion = 0x300;
lpLogPal->palNumEntries = 256;
// Copy the current system palette into the logical palette.
GetSystemPaletteEntries(hDC, 0, 256,
(LPPALETTEENTRY)(lpLogPal->palPalEntry));
// Create the palette.
hPal = CreatePalette(lpLogPal);
// Clean up.
GlobalFree(lpLogPal);
ReleaseDC(NULL, hDC);
return hPal;
}
// Create a 24-bit-per-pixel surface.
HBITMAP Create24BPPDIBSection(HDC hDC, int iWidth, int iHeight)
{
BITMAPINFO bmi;
HBITMAP hbm;
LPBYTE pBits;
// Initialize to 0s.
ZeroMemory(&bmi, sizeof(bmi));
// Initialize the header.
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = iWidth;
bmi.bmiHeader.biHeight = iHeight;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 24;
bmi.bmiHeader.biCompression = BI_RGB;
// Create the surface.
hbm = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pBits, NULL, 0);
return(hbm);
}
// Print the entire contents (including the non-client area) of
// the specified window to the default printer.
BOOL PrintWindowToDC(HWND hWnd)
{
HBITMAP hbm;
HDC hdcPrinter;
HDC hdcMemory;
HDC hdcWindow;
int iWidth;
int iHeight;
DOCINFO di;
RECT rc;
DIBSECTION ds;
HPALETTE hPal;
// Do you have a valid window?
if (!IsWindow(hWnd))
return FALSE;
|
|
|
|
|
I have the following code:
char *CEditString::TrimLeft(char *str)
{
if (str != NULL)
{
int len = strlen(str);
int i=0;
while (isspace(str))
i++;
char *newstring = new char[len-i+1];
int j;
for (j=0; j
|
|
|
|
|
As your code is now, it's the responsibility of the caller to delete the memory the function allocates. This works, but it puts an extra burden on the caller and ties it to the implementation of the function.
A nicer way to do it is have the caller pass in a buffer and the size of the buffer, and have the function return the string in that buffer.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Can you give me an example, please, please?
|
|
|
|
|
Sure!
bool TrimLeft ( LPCTSTR szOrigStr, LPTSTR szOutputStr, UINT uBuffSize )
{
int i = 0;
while ( isspace( szOrigStr[i] ))
i++;
if ( uBuffSize < (lstrlen(szOrigStr) - i + 1) )
return false;
lstrcpy ( szOutputStr, &szOrigStr[i] );
return true;
}
You'd call it thus:
{
TCHAR szOrigStr[] = _T(" foobar");
TCHAR szTrimmedStr[64];
TrimLeft ( szOrigStr, szTrimmedStr, 64 );
}
That way, the caller has control over the buffer. Most of the Windows APIs do it this way, so programmers are comfortable with it.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Hi,
Here is my code to launch programmatically some net send commands :
if( !CreateProcess( NULL,
"Net.exe send COMPUTER2 Good morning" , NULL, NULL, FALSE, 0, NULL, NULL,
&si, // Pointer to STARTUPINFO structure.
&pi )) // Pointer to PROCESS_INFORMATION structure.
{
// I display here CreateProcess error message with GetLastError()
}
else
// OK Message is sent
This code work very well, but i dont know how to get errors messages.
For example under MS DOS windows if write the following command :
C:\>net send COMPUTER2 "Good morning"
The following error appear :
"an error is appear when sending message to COMPUTER2"
see NET HELPMSG 2273 for more....
CAN ANYBODY HELP ME HOW CAN I GET THIS ERROR PROGRAMMATICALLY ??
Thanks in advance
|
|
|
|
|
hi I have got some basic questions to ask : how to create a new .rc file with VC++ 6.0 and why the need to create a workspace(.dsw file)? Furthermore why the need to create a .dsp file.
|
|
|
|
|
DSP files are project files. They are similar to make files. They hold all the filenames and file dependancies for each name. Without a .dsp file, the compiler would only be able to compile one file at a time.
DSW files are for collections of DSP files. It stores project dependancies between projects. If you only have one project in a workspace, then it's kind of pointless.. but still necessary.
You create an .rc file by simply going to the Insert menu item and choosing "resource" It will create an RC file for you (If I recall correctly). You can't have more than one .RC file in a project (officially. Unofficially, you can create multiple .RC files and #include them in your main .RC file, but that's a pain and not well supported.)
The easiest way to create a new .RC file if you already have one is to create a new project and add one to that, then copy it to your ole project.
|
|
|
|
|
Now i need to complie my .cpp , .h & .rc files , so i need to put them in the same project and insert into a workspace to create a .exe file ? Is this what I should do ? Or can you reommend a good visual c++ book so that I can refer because I am very new to c++
|
|
|
|
|
Now i need to complie my .cpp , .h & .rc files , so i need to put them in the same project and insert into a workspace to create a .exe file ? Is this what I should do ? Or can you reommend a good visual c++ book so that I can refer because I am very new to c++
|
|
|
|
|
I have found more and more examples on how to copy text, bitmap, metafile, and any other type of data to the clipboard; but I can't find a simple example on how to copy a file to the clipboard and let Windows Explorer recognize it and paste it in a directory.
I have no shells but only the full-path file name.
|
|
|
|
|
Hi everybody,
is there an easy way to change the window caption font for modal or modeless dialog boxes?
I just want to change the font and want MFC to do the rest of the work, like drawing the text and
the min/max buttons etc..
TIA, Chris
|
|
|
|
|
There is code either on this site, or on www.codeguru.com (yuk!) that you could talor to your needs. Some change the background colour, and others allow more than one line of text. It's time for me to go home so I'm afraid you'll have to look for the articles yourself!
HTH
Jerry
|
|
|
|
|
No, there is no way to change the caption font and allow Windows or MFC to do the rest of the work for you.
There are, however, several classes available here and at codeguru to do this, to make it easier to implement.
|
|
|
|
|
Hi,
Can U hide the Scrollbars of a CTreeCtrl object? Help me.
Thanks in advance.
Ngo Khai Hoa
|
|
|
|
|
Add TVS_NOSCROLL style to the CTreeCtrl Object.
It is that simple.
Sundaravalli Shriram
Tektronix Engineering Development India Ltd,
Bangalore - 560001,
India.
|
|
|
|
|
Can anyone help me find information how make a view wityh look like outlook todaypage.
This view is like a html page.
thanks
|
|
|
|
|
It's not "like" an HTML page. It *IS* an HTML page.
|
|
|
|
|
Is there a method to export registry settings just like the one i used in regedit.exe? If yes, how to export programmatically?
Thanks all
|
|
|
|
|
visit http://zmanagers.chat.ru
you can find there Registry.cpp in sources.
I wrote there a function which makes this task.
Mike.
|
|
|
|
|
How can I create a virtual disk at RAM, and the disk should write all the contents to the physical disk file.
Any help are appreciate.
|
|
|
|
|
Hello all,
I recently wrote a security program with MFC that configured registry policies. The problem is that a script kiddie using a disassembler went right past my security measures by simply skipping to the place in the code that was past my password protected section. Is there a good way to protect against disassembers?
--Tale
|
|
|
|
|
If your security check is in code like this:
if ( !ShoudILetTheProgramRun() )
{ // show messages saying the app won't run
// and then exit
}
Then it's trivial to bypass. Don't make the security check that painfully obvious.
--Mike--
http://home.inreach.com/mdunn/
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Could you be a little more descriptive in your solution. I'm not familiar with disassemblers, so I really don't know what the weakness in my program is.
The way I'm checking for proper users is by reading an encrypted password from the registry and comparing it with what they supplied. If they are equal, I call the method to let them into the protected area. What are you suggesting I change?
--Tale
|
|
|
|