|
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.
|
|
|
|
|
I have created the appliaction for 2000/XP 32 bits. And i want to run my Application on Vista so what are the changes that i have to make my application Vista compitible.
Note :-I am using Visual srudio 2005
With Regards
RYK
|
|
|
|
|
VC_RYK wrote: what are the changes that i have to make
With luck, none at all. Most XP programs will work fine, although with some annoying UAC messages. You will have to try it and see.
|
|
|
|
|
what is the purpose of OnCtlColor
i have used one brush in onctlcolor and i am returning the handle of that brush.
cos of that GDI objects(can see in task manager) are going on increasing and memory usage is also increasing.
if i comment that brush everything is ok.. nothing is increasing. but in my application i must use that brush to draw the whole application.
can anyone give me solution to solve that problem
regards
sudhakar
|
|
|
|
|
make the brush a member of your Window class!
what is the purpose of OnCtlColor=> RTFM
Greetings from Germany
|
|
|
|
|
i need to change the color of the the entire dialog not only the controls on that dialog.
regards
sudhakar
|
|
|
|
|
The background can you paint in OnEraseBkgnd()
Greetings from Germany
|
|
|
|
|
I guess you are creating a new brush in every time in OnCtlColor function.
if yes a simple solution would be to
1>make the brush object as a memeber of a classs
2>create thebrush object only once say in the constructor.
3>return the same handle every time in the function.
4>delete the object in the destructor.
Thanks
Rizwan
|
|
|
|
|
Hi all,
Lets say one has created a thread using _beginthread() and now that thread is active and running. Now one wants to pass arguments to that thread function, but remember that the thread was already created. Now ... how can one (if it is possible) call that thread function, without calling _beginthread() again.
I.E
int callThreadFunc()
{
}
void myThread(void* a)
{
while (1)
{
Sleep(1000);
}
}
void main()
{
_beginthread(myThread, NULL, 0);
...
}
Many Thanks
Regards,
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
My Blog: ^_^
|
|
|
|
|
with global variables, but you have the problem of syncronizing. If threads work together you need to syncronize them!!! Everything else is crap. For instance with WaitForMultipleEvent()
Greetings from Germany
|
|
|
|
|