|
Sorry about that - wouldn't have been able to help you last night otherwise, beacuase I didn't have time to port it to C++. But here it is!
<br>
HBITMAP phBmp;
HDC WorkDC;
WorkDC = CreateCompatibleDC(hdc);
phBmp = CreateCompatibleBitmap(mvarhDC, mvarDocWidth, mvarDocHeight);
poldbmp = SelectObject(WorkDC, phBmp);
StretchBlt (WorkDC, 1, 1, IBmp->bmWidth, IBmp->bmHeight, mvarhDC, 1, 1,Bmp->bmWidth,Bmp->bmHeight, SRCCOPY);
SelectObject(WorkDC, poldbmp);
SelectObject(mvarhDC, phBmp);
DeleteObject(mvarhBmp);
DeleteDC(WorkDC);
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
|
Dear All,
I am developing a MFC dialog based application which requires facility of a Hotkey. ie. if I press hot key combination such as Ctrl+Shift+P , then my dialog application should come.
(like we press Windows button + e and "Explorer" window appears)
Please suggest
Rohit
|
|
|
|
|
Just create a shortcut to your app with the hotkey Ctrl+Shift+P.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Actally this dialog window is a part of my application . And I want that this window should appear if we press a hotkey (even if the application is closed)
|
|
|
|
|
Use the RegisterHotKey API. Whenever the user presses the hotkey you specified, your window will receive a WM_HOTKEY message.
Like this:
result=RegisterHotkey(
hwnd,
id,
MOD_ALT || MOD_CONTROL,
VK_M
);
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
|
dear all,
how do i add MFC support to my win32 application created using app wizard.
|
|
|
|
|
i meant to say which headre files r to be included in the project apart from changing the settings (use mfc in a shared dll) in the projects menu.
regards and thanx
rishabhs
|
|
|
|
|
Include afx.h, but there might be others that you'll need to include. Here's the default includes for a dialog based app:
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h>
#include <afxext.h>
#include <afxdisp.h>
#include <afxdtctl.h>
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>
#endif // _AFX_NO_AFXCMN_SUPPORT
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
I have two files:
aa.txt:
20020102,23.0
20020103,23.0
.............
20030301,35
bb.txt:
20010101,22
20010102,25
...........
20021220,23.5
Now I want to append the latest datas ( from the "20021220,23.5" to "20030301,35") of the file "aa.txt" to the file "bb.txt".
How could I do ! Please tell me the easy way to do it!
The latest datas in the file aa.txt are the datas that are not included in the file bb.txt.
Note: i only want to append the datas that the bb.txt is not included.
I wrote the following:
Please help me ! what's wrong with the following;
while(fileDest.ReadString(strLine0))
//get the last line of the writed file bb.txt
{ if(strLine0.GetLength()>10)
{ strMax=strLine0;
}
}
while(fileSource.ReadString(strLine))
{
//get the line of the read file aa.txt is equal to the last line of the writed file
if(strLine.Left(strLine.Find(','))==strMax.Left(strMax.Find(',')))
{
//get the read position of the file aa.txt
theReadPosition=fileSource.GetPosition();
break;
}
}
// the term is true , then read line from the aa.txt
while(fileSource.ReadString(strTemp))
{
if(strTemp.GetLength()<10)
continue;
fileDest.WriteString("\r\n"+stTemp);
}
fileDest.Close();
fileSource.Close();
|
|
|
|
|
Hi guys,
I am trying to add double slashes in front of a string, I am wondering it can be done as below
Assuming both variables have contained some characters
char *FileString; // a pointer to character string
char Buffer[256]; // an array to 256 characters
FileString = '//' + Buffer;
Please advise,
Thanks alot
|
|
|
|
|
Use strcat()
-Nick Parker
|
|
|
|
|
strcat() won't work as it accepts only constant char* , which buffer[] isn't. It crashes the program upon that point.
e.g.
char string[200]
strcpy(string, "\\");
strcat(string, Buffer); <-- won't work here.
Any suggestions?
Thanks again
|
|
|
|
|
U can try like this.
CString strFileString;
CString strSlah("//");
char szBuffer[256];
strFileString=strSlash+szBuffer;
regards
anju
anju
|
|
|
|
|
C-style strings don't work like that. You should be using std::string unless there is an overriding reason not to:
std::string FileString;
std::string Buffer = "some stuff...";
FileString = "//" + Buffer;
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Thanks guys,
I tried not to use std::string as I am not sure if it's portable to Embedded Visual C++. I am doing the program using Visual C++ and expecting to make it workable on iPAQ when re-compling.
|
|
|
|
|
AFAIR STL is not avaliable in eMbedded Visual C++
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
strcpy(FileString, "//");
strcat(FileString, (char *) Buffer);
Brian
|
|
|
|
|
I'm struggling on this one... appreciate any hints you experts can offer.
Just trying to print out a histogram, using asterisks, to show the number of times each number 2-12 was rolled, after 50 rolls. I created the following two loops and cannot get the asterisks to continue to the next line as appropriate
<br />
max = maximum (frequency, arraySize); <br />
<br />
for (int countDown = max; countDown >= 0; countDown--)<br />
<br />
for (int j = 0; j < (arraySize-2); j++) <br />
<br />
if (frequency[j+2] <= countDown)<br />
cout << setw(3) << "*" << " ";<br />
<br />
else<br />
cout << setw(3) << " " << " ";<br />
<br />
<br />
for (face = 2; face < arraySize; face++)<br />
cout << setw(3) << face << " ";<br />
I tried adding an if statement---> if (j%10 == 0) cout << endl;
doesn't work.
Any suggestions?
Thanks so much!
Sheshi
|
|
|
|
|
When writing a for loop you need to use the curly braces when your statements within that for loop extend beyond 1 line. The two examples are the same, writing a new line doesn't occur until after the inner for loop has completed:
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < i; j++)
{
cout << "*";
}
cout << endl;
}
or
for(int i = 0; i < 10; i++)
{
for(int j = 0; j < i; j++)
cout << "*";
cout << endl; <font color="green">
}
-Nick Parker
|
|
|
|
|
Thanks Nick! That gets me one step further to figuring this thing out!;)
Sheshi
|
|
|
|
|
I wanna use HOOK to catch the BM_SETSTATE message of a button,and i don't wanna return it to the button.i catch the BM_SETSTATE and did't return ::CallNextHookEx(hHook,nCode,wParam,lParam);
but the message is still pass to the button when i push "OK" of the Messagebox.
Pls. see my code here:
LRESULT CALLBACK CallWndProc(int nCode,WPARAM wParam,LPARAM lParam)
{
if(nCode != HC_ACTION)
{
return ::CallNextHookEx(hHook,nCode,wParam,lParam);
}
if(nCode == HC_ACTION)
{
pCwp = (CWPSTRUCT *)lParam;
if((wParam == 0) && (pCwp->message == BM_SETSTATE))
{
TRACE(childWinList[107].winText);
//MessageBox(NULL,childWinList[107].winText,childWinList[110].winText,MB_OK);
::SendMessage(pCwp->hwnd,WM_GETTEXT,256,(LPARAM) b);
CString a = b;
if (a == "Confirm Load")
{
GetWindowsList();
if (childWinList[107].winText != childWinList[110].winText+"_"+childWinList[89].winText)
{
if (!bShow) return -1;
bShow = 0;
if(IDOK == MessageBox(NULL,"The device Number and program name do not match!",b,MB_OK))
{
bShow = 1;
}
return -1;
}
}
}
}
return ::CallNextHookEx(hHook,nCode,wParam,lParam);
}
|
|
|
|
|
I'm developing an app in VC6 & MFC where I'd like to ship multiple versions of the software utilizing the same base source code. By multiple versions, I mean two variations of the same application. One version will be like a "Basic" version and another will be an "Advanced" version. So basically the same idea as Windows 2000 Pro and Windows 2000 Server. Both pieces of software utilize the same base code, generally speaking, but have different features available.
I'm looking for ideas, methodologies, approaches, design, etc. on how to implement this. Is the only answer preprocessor directives? What about some type of plug-in approach? The result needs to be able to modify the UI (menu bar, menu items, etc.) I've done a little research on the web but haven't found a "clean" approach to this problem. Help! Thanks
|
|
|
|
|
My article may be of use:
Plug-in architecture for MFC[^]
sounds to be what you need.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|