|
If you want to save the image in bitmap form there are some articles on this site or codeguru.com that show you how to do that. You may also like to investigate the ImgSource DLL which can save other image formats and has some bonuses in providing other image processing functions as well.
Happy programming!!
|
|
|
|
|
If you create a DC using CreateWindowDC(NULL) it will point to the whole screen. As well as using this to Blt TO the screen, you can Blt FROM it into a DC, and thus create the bitmap you want to save out. I recommend using Paintlib to sav your bitmaps, not least because of the ability to save jpg's and do funky stuff on the way. www.paintlib.de.
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 , I need to know how to complie a .h file as I cannot do it because the complier says i dun have a complier tool. Thanks for helping
|
|
|
|
|
This is normal. If you have a .h file open in the VC IDE and hit ctrl-F7, you get this message.
VC associaltes C and CPP files with translation units, not .h files. I don't know of a good answer why, or if an association can be set for .h files. Never tried.
To compile the header, just make a .cpp file that includes it, and compile that.
|
|
|
|
|
Can anyone recommend a good visual c++ book for beginners ?
|
|
|
|
|
How much of a beginner ? Visual C++ in24 hours is nice & clear, long term MFC Programming using isual C++ Unleashed goes into more epth and is a long term reference.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I'm new to both Windows and Visual C++. About a year ago I did some slight programming in it and really enjoyed myself. I was wondering what I should read/do to get a good start. I know the ANSI/Console C++ rather well, I'm just new to the pure OO programming aspect of MFC/Windows SDK. Also, you can use both MFC and the Win SDK with the VC++ compiler, or not? Thank you for taking the time to read/answer this.
-Scott
|
|
|
|
|
In answer to question 2: yes, you can elect to use MFC or exclude it from your project when you set up with the new project wizard. Check my answer to the above question re: books.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Hello all,
Before I ask the question/state the problem here is some
sample code.
int someFunction(int param1,
int param2)
{
int localVar1;
int localVar2;
localVar1 = callAFunc1();
localVar2 = callAFunc2();
return localVar1 + localVar2;
}
The question is, if I was writing a debugger and I had the address of say, localVar1 or localVar2 and I knew it was on the stack. Does anyone know how to translate the stack address into a variable name?
I know how to get the function name etc, but how do I get
the variable name?
Stephen Kellett
(still not logged on, obviously I can't even remember my new password...sigh)
|
|
|
|
|
I need a clever tip, about getting the right mouse button over a Picture Box.
|
|
|
|
|
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.
|
|
|
|