|
Thanks, it wokrs now. I use global variable for the CPropertyPage. There need to be free g_... in DllMain too.
|
|
|
|
|
I program for a hobby and only have Visual C++ 5 with service pack 3 and no there is no way I can afford VC++ 6. Now I keep seeing projects for VC++ 6. I try to build them in 5 and I cannot. Is there any way to update my libs and includes so that I can compile these projects for Visual C++ 6. Or am I out of luck. Hopefully I am not out of luck!
|
|
|
|
|
Hi !!
Just create new project "Win32 Application" with opntion = "An empty project"
after it copy all files from example project to your new ProjectFolder
without *.dsw,*dsp(its just project files info)
Next step :
In "WorkSpace"-window select tab "FileView"
in folder "Source Files" click MouseRightButton and select "Add Files to Folder.." from Menu
and select all needed files ( *.h, *.cpp, *.rc)
Select from VisualStudio menu "Project">"Settings" and in "all configurations"
in the first tab select "Use MFC in....." from ComboBox , press "OK"
Dont forgot coping "RES" folder to your new project.
After it press F7
hopefully i'm did't any mistakes in this Doc )
Sorry my English so....
Good Luck !!
|
|
|
|
|
I'm a flesh VC programer, and now I must add a shortcut
of a program to the desktop using VC++, but I don't know
how to make it.
I need help, please help me.
Thank you very much indeed.
|
|
|
|
|
Check out the IShellLink interface in MSDN.
HTH, Jens
|
|
|
|
|
Hi im working on a project that requires me to use a status bar of type CStatBarCtrl, and in that object it must have 4 panes... 3 of these four panes mush have text in them that is colored differently than the other 2 as kinda a key to let users know what colors mean what..My problem is I have everything working just fine, except the coloring of the text.. This is supposed to turn out very similar to the Visual Source safe show differences dialog text at the bottom of the status bar... If anyone knows anything , help would be greatly appreciated.
Please email me
sincerely
Josh B. Williams
|
|
|
|
|
Not such a stupid question. Probably the fastest for now is to have a look at Julian Smart's page..
http://www.anthemion.co.uk/
and his CEnhStatusBar Class as guide.
Alternatively overide the OnPaint for your status bar and then you will have paint every paint yourself. Or place Static controls on the Status bar and change the text colour in those.
Happy programming!!
|
|
|
|
|
hi I need to archive a screen capture output to a file . Can anyone help me ? The screencapture source code is shown below or does anyone has a better suggestion about doing it by altering the code below?
// 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);
}
|
|
|
|
|
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
|
|
|
|