|
You didn't show how you are creating the image list. It needs to be masked...
// assuming icons are 16x16
m_ImageList.Create(16, 16, ILC_COLOR24 | ILC_MASK, 0, 1);
...
m_ImageList.Add(LoadIcon(hIcon));
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
|
Electronic75 wrote: I was wondering what is your mean from the phrase in your signature
That's a quote from the move "Better Off Dead".
Those are skiing instructions (they work for extreme programming as well )
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
THIS WORKS
file is appended with the text "###, 28/06/07, 09:30, 1.736, 1.234"
Message Box correctly reports fileName as expected.
fstream FileDataStream;
// Read Data
FileDataStream.open(fileName, ios::out | ios::app);
// Append Data
FileDataStream<<"###,";
FileDataStream<<(LPCSTR)dateString<<','<<(LPCSTR)timeString<<',';
sprintf(buf, "%.4f,", eTable[5*sel + 2]); // GeskeDose
FileDataStream<
|
|
|
|
|
Looks like I needed to call
FileDataStream.clear();
I think that some error flag is set when the while loop pulls in the EOF marker while reading the file, and that is what causes the problem when you next try to open it.
|
|
|
|
|
Hi, I'm trying to write a simple hello world application with Visual C++ 6.0 and I get the following errors:
Compiling...
Run.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Test2\Run.cpp(13) : error C2664: 'MessageBoxA' : cannot convert parameter 2 from 'unsigned short [13]' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
Here's my code:
#include <windows.h> // include the basic windows header file
// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
// create a "Hello World" message box using MessageBox()
MessageBox(NULL,
L"Hello World!",
L"Just another Hello World program!",
MB_ICONEXCLAMATION | MB_OK);
// return 0 to Windows
return 0;
}
Any help would be greatly appreciated regarding what's the error.
|
|
|
|
|
try simply :
MessageBox(NULL,"Hello World!","Just another Hello World program!",MB_ICONEXCLAMATION | MB_OK);
|
|
|
|
|
Thanks a lot, it worked. Sorry I'm kind of new. Do you know why? All I did was copy the code from a textbook. Thanks again.
|
|
|
|
|
"Hello" is a simple string of char's - which is constant in your code
so it's a const char *
typing L"Hello" , specially the L before the string realises a special casting(*), but i don't know
in which type. Regarding your error-message the L does make a casting to a short array
* Casting: is a forcing of a data-type into another type
For example
int number = 69; --> a real number data type
char test = (char)number; --> forces the number 69 into a char, regarding the ASCII-Coding, the Number 69 is the character 'E'
test will store 'E' after this line of code
|
|
|
|
|
Because the macro L"..." (as you put it as argument to the MessageBox function) tells the compiler that the string literal (so the string that is between "") should be considered as a UNICODE string. A UNICODE string is a string that can display a larger set of character but also means that each character is encoded on two bytes instead of one. This string type is 'incompatible' with a standard char array (you cannot exchange from one to the other).
In fact, you won't have any error if you specified that UNICODE is enabled for your project. But in the case of VC6, the default is that UNICODE is disabled. If you used Visual Studio 2005, UNICODE is enabled by default.
Now, to avoid these kind of errors, use the _T macro instead. It will automatically take care of UNICODE setting enabled or not.
|
|
|
|
|
MSDN [^]states: To specify a string of type wide-character (wchar_t[]), precede the opening double quotation mark with the character L. For example:
wchar_t wszStr[] = L"1a1g";
hence your string is a wide-character one, while the MessageBoxA (note the A suffix) is the ANSI version of the MessageBox , choosen by the compiler because you are making an ANSI build (the default one, on VC6). MessageBoxA accepts only ANSI strings (i.e. char * ) while your strings are wide (i.e. unsigned short * ), hence the error shows up.
Perhaps the sample code you used assumes you're using a later version of Visual Studio, that has UNICODE builds as default.
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
Hi,
Can anybody help me out how to create a "Data Source Name" from my C++/MFC program?
I am using VC++8, Windows XP, and MySQL.
Pradosh
|
|
|
|
|
try
SQLConfigDataSource(...) API
|
|
|
|
|
I was trying to get some help on SQLConfigDataSource(). I am not able to find any help in MSDN. Which header file it is belonging or so on so!
Currently I am using a reverse way to do the same:
<br />
system("odbcconf /S CONFIGDSN \"MySQL ODBC 3.51 Driver\" \"DSN=MyDsn | Description=test dsn | SERVER=10.1.1.4 | User=user1 | Password=pw1 | Database=MyDb\"");<br />
But I want to use any API to do the same.
Pradosh
|
|
|
|
|
imp lib: ODBCCP32.lib
include file : "odbcinst.h"
ref:
http://www.codeguru.com/cpp/data/mfc_database/microsoftaccess/article.php/c1135/
|
|
|
|
|
extern "C" int sqlClass::createDSN(char* driver, char* keyword)
{
int returnValue;
try
{
returnValue = SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN,(LPSTR)driver,(LPSTR)keyword);
if (returnValue)
return 0;
return -1;
}
catch(...)
{
MessageBox(NULL,"Exception Occured - DSN not created","Error Occured",MB_ICONHAND);
return -2;
}
}
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
I'm curious....does SQLConfigDataSource throw exceptions? You have it wrapped in a try block.
Mark
"Go that way, really fast. If something gets in your way, turn."
|
|
|
|
|
Hi all,
I need some good file encryption with password.Can you some suggest some thing.Please note that I am new to VC++
Dana
|
|
|
|
|
|
I don't know chinese.Not able to read the web site content/
|
|
|
|
|
i have created a mfc code in windows vista. but i cant run it in debug mode. it shows
"The ordinal could not be losded in the dynamic link library MFC42D.DLL". but it is successfully running in release mode. what to do for this, pls help me
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
XP and Vista installations include the VS6 MFC release-mode Dlls, but not the debug-mode DLLs. You have to copy the MFC debug DLLs to the machine where you want to run. To find out which DLLs you will need, google for the dependency checker program Depends.exe.
|
|
|
|
|
Find out MFC42D.dll , and copy to system32 directory .
|
|
|
|
|
In my program I have used a lot of resouce. Such as: image(bmp, gif,...), config file(xml, txt, ini).There are more than 100 images and 10 config-files which is saved in a lot of folders. Now I don't want the user directly change or see these images and config files. Is there any way to package or make these resource unreadable.
Currently, my resources are all in the folder.I haven't compile them into my program.
I know vc6.0 can manage the resource. But it is still too weak for me. I want to manage my resource like a tree. Can add a directory or resource just as I want.
Maybe I will have to develop a resource manage tool.
|
|
|
|