|
You need to wrap the IDI_ICON3 with MakeIntResource as shown in the snippet below:
HRSRC hRscDLL = FindResource(NULL,MAKEINTRESOURCE(IDI_ICON3),RT_ICON);
if (hRscDLL)
{
DWORD dwIconSize = SizeofResource(NULL,hRscDLL);
HGLOBAL hMem = LoadResource(NULL,hRscDLL);
if (hMem)
{
LPVOID pIconBytes = LockResource(hMem);
if (pIconBytes)
{
.........
|
|
|
|
|
Still not having any luck
Now i have this:
hResource = FindResource(hModule,MAKEINTRESOURCE(IDI_ICON3),RT_ICON);
but yet it still comes back as NULL
Here is how it's defined in the .rc file for the app I'm loading:
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON3 ICON DISCARDABLE "Eye.ico"
So what the heck am I doing wrong?
Any other ideas, suggestions, comments? You're helping alot so far.
thanks!
Dan
|
|
|
|
|
Does IDI_ICON3 equate to the same number in both applications?
|
|
|
|
|
DavidCrow wrote:
Does IDI_ICON3 equate to the same number in both applications?
good question.
But yes they are the same number. I made sure they were.
The number is 104, and I made sure that the number is the same.
any other ideas
Thanks!
Dan
|
|
|
|
|
Woo Hoo!
I finally understand it!
Turns out that I need to be using the RT_GROUP_ICON because I'm not using hardware-dependent icons. I was then able to try other resource types and successfully got the information I needed.
Thanks Guys! I really appreciate the help!
Dan
|
|
|
|
|
I want to draw lines on a dialog in MFC(SDI) application.
Currently I am doing the same thing in OnDraw function of my CAppView by using the code.
pDC->MoveTo(x1,y1);
pDC->MoveTo(x1,y2);
Now I want to draw these lines on a dialog. Is it possible. Can I use the same functions. If yes, Then what would I use in place of pDC to call these functions.
If not refer me other ways of doing so.
Reply me soon
|
|
|
|
|
pDC->MoveTo(x,y)
That is the startpoint where you will start drawing your line. I don't see why you move 2 times to the same place.
I think you want something like this
pDC->MoveTo(startpointx, startpointy);
pDC->LineTo(endpointx, endpointy);
so you needed LineTo with a EndPoint of course
i hope this helps
Greetings
Jens
|
|
|
|
|
Do the same thing you did in OnDraw() only do it in the dialogs OnPaint().
Trust in the code Luke. Yea right!
|
|
|
|
|
Hello,
this:
CFileDialog dlg(FALSE);
CString fname = dlg.GetPathName();
const char* szBuffer = fname;
int i = sizeof(szBuffer);
CFile f;
if( f.Open ("F:\\test\\id.txt", CFile::modeWrite ) ){
try{
f.Write(szBuffer, i);
f.Close();
}
catch (CFileException *e){
AfxMessageBox ("Error!");
e->Delete();
}
}
}
...if you type in "rtf" it insert in my "id.txt" file:
F:\r¼ÖA Q a ¼ºÜþ4 ýýýý€*0 *0 ¬)0 Ì(0 ÍÍÍÍÍÍÍÍØ(0
why??
Thanks, Mark
|
|
|
|
|
You might want to try:
CFileDialog dlg(FALSE);
CString fname = dlg.GetPathName();
const char* szBuffer = fname.GetBuffer(0);
int i = fname.GetLength();
CFile f;
if( f.Open ("F:\\test\\id.txt", CFile::modeWrite ) )
{
try{
f.Write(szBuffer, i);
f.Close();
} catch (CFileException *e)
{
AfxMessageBox ("Error!");
e->Delete();
}
}
fname.ReleaseBuffer();
-Mike Zinni
"No sh*t it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."
|
|
|
|
|
It works!!!!Thanx.
Thanks, Mark
|
|
|
|
|
By the way, how can i change the code to read the file?
Thanks, Mark
|
|
|
|
|
Try:
CFileDialog dlg(FALSE);
CString fname = dlg.GetPathName();
char* szBuffer = NULL;
int i = 0;
CFile f;
if( f.Open ("F:\\test\\id.txt", CFile::modeRead ) )
{
try {
i = f.GetLength();
szBuffer = new char[i];
if(szBuffer != NULL)
f.Read(szBuffer, i);
f.Close();
} catch (CFileException *e)
{
AfxMessageBox ("Error!");
e->Delete();
}
}
if(szBuffer != NULL)
delete [] szBuffer;
-Mike Zinni
"No sh*t it's tough. If it wasn't, everybody and their sister would be an engineer and then you wouldn't have a job."
|
|
|
|
|
I must cast the szBuffer to a CString type:
CString csPath = szBuffer;
is this allowed?
Thanks, Mark
|
|
|
|
|
Actually, this implicitly casts szBuffer to a LPCTSTR, which CString has an assignment operator for.
|
|
|
|
|
Nice, but still generates test.pmjyyyxx as output????
Thanks, Mark
|
|
|
|
|
CFileDialog dlg(FALSE);
dlg.DoModal();
CString fname = dlg.GetPathName();
const char* szBuffer = fname;
char s[128];
int i = lstrlen(szBuffer);
CFile f;
if (f.Open("F:\\test\\id.txt", CFile::modeWrite | CFile::modeCreate) == TRUE)
{
try
{
f.Write(szBuffer, i);
}
catch (CFileException *e)
{
AfxMessageBox ("Error writing!");
e->Delete();
}
f.Close();
}
if (f.Open("F:\\test\\id.txt", CFile::modeRead) == TRUE)
{
try
{
f.Read(s, i);
}
catch (CFileException *e)
{
AfxMessageBox ("Error reading!");
e->Delete();
}
}
|
|
|
|
|
int i = strlen (szBuffer);
rechi
|
|
|
|
|
Hi
Let's say i have a CString:
CString mytext = "1G-I8-EJ-89-B6";
I want to have a little security and i thought of substituting some characters with some others within that CString.
Like for example:
'0' to 'J'
'1' to 'H'
'2' to 'A'
I thought of making a two-dimensional char array.
'0' 'J'
'1' 'H'
'2' 'A'
'3' '9'
....
is there a short way to write this?
instead of using mychar[0][0]='0';
mychar[1][0]='J';
and how can i easily convert an int to a char?
Best regards
Jens
|
|
|
|
|
hi,
try this one
in your header file declare:
<br />
extern char Array2ofChar[2][10];<br />
in the correspondending c/cpp file write:
<br />
char Array2ofChar[2][10]=<br />
{{'0','1'},<br />
{'A','2'},<br />
...<br />
};<br />
that should do the trick.
G. Steudtel
|
|
|
|
|
Hi
I've been searching a long time for a code sample that could show me how to create a Virtual Serial Port with C++ under Windows 2000.
I need to design a app that creates a virtual serial port and then all the data that is sent
to that virtual serial port needs to be transformed and redirected to a serial port on this PC.
Thanx!
Dirk
|
|
|
|
|
How do i convert a "unsigned char[8]" 8 byte array to a long. Please help. Many thnx in advance.
|
|
|
|
|
|
thnx for the reply, but that's not exactly what i'm looking for. I solved it by using a union.
union x
{
unsigned char[8] ucaByteArray;
double d;
};
Because it's a union, they share the same address space, which means the content of all the 8 element can be accessed directly by the double. This is precisely what i want, and it works great.
|
|
|
|
|
hi all,
i want to show a web page in a dialog box..i dont know what control to be used and how it should be done...I will be thankful for all suggestions and pointers..Please help me...
thanks in advance..
Himanshu
|
|
|
|