|
SQLConfigDataSource -> lpszAttributes
List of attributes in the form "keyname=value". These strings are separated by null terminators with two consecutive null terminators at the end of the list.
Try this instead:
CString var4, v1, v2, v3;<br />
<br />
v1 = "myfinger";<br />
v2 = "SERVER";<br />
v3 = "emp";<br />
<br />
var4.Format("DSN=%s\0Server=%s\0Database=%s\0", (LPCTSTR)v1, (LPCTSTR)v2, (LPCTSTR)v3);<br />
<br />
SQLConfigDataSource(NULL, ODBC_ADD_DSN, "SQL Server", (LPCTSTR)var4);
I think this will work for you.
|
|
|
|
|
hi,
Thanks for ur reply..But it is also not working..You can also try to create DSN using above ur code:
void testDlg::OnButton2()
{
CString var4, v1, v2, v3;
v1 = "myfinger";
v2 = "SERVER";
v3 = "emp";
// this generates paramaters separated by a single NUL character
// and a sting terminated with two NUL characters
var4.Format("DSN=%s\0Server=%s\0Database=%s\0", (LPCTSTR)v1, (LPCTSTR)v2, (LPCTSTR)v3);
if(!SQLConfigDataSource(NULL, ODBC_ADD_DSN, "SQL Server\0", (LPCTSTR)var4))
AfxMessageBox("error");
}
But I got Error for this..
Thanks in advance..
|
|
|
|
|
I have created a separate thread to continuously monitor the serial port (i.e. to wait for something to arrive and then read it out)
Is it possible to write to the serial port at the same time (in the main thread), or does the read thread block. I have tried...it didn´t work, but the problem might be somewhere else...
If I cannot send while monitoring the port, what would be the proper solution? Do I have to temporarily Suspend, Sleep or Abort the thread while performing the write operation?
doneirik
|
|
|
|
|
IIRC you should use overlapped IO for the serial read write.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
it is not neccessary to write in a thread - thread is for waiting (reading) events.
before u write, u need to check if writing (sending) buffer is empty - otherwise writing fails.
i have worked for years on your current job.
includeh10
|
|
|
|
|
How can I change the background color of dialog form in a MFC application.
can anyone help me regarding this project ?
Philip
|
|
|
|
|
Write an event handler for WM_CTLCOLOR and change the color there.
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
Here is Small Code that Will Help
HBRUSH CExeCreatorDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor ==CTLCOLOR_EDIT)
{
return hbr;
}
::SetTextColor(pDC->GetSafeHdc(),DLGTEXTCOLOR);
::SetBkColor(pDC->GetSafeHdc(),PUNTO_BGCOLOR);
hbr=CreateSolidBrush(PUNTO_BGCOLOR);
return hbr;
}
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Alok, I am Butt not Bhatt . There is a very small difference in spelling but a lot of difference otherwise.
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
Bro!
Please Don't Mind, there is Nothing Intentional.
Aamir Butt wrote:
there is a very small difference in spelling but a lot of difference otherwise.
Yeah I know the meaning of these two Surnames, I am sorry by heart, If it hurt you.
"I Think this Will Help"
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Its OK, no hard feelings
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
I have seen the code u sent to me through email. Normally its not a good idea to contact individual person coz if u ask question here, other people can get benefit of it as well.
Well, the problem in that code is that the place where u have checked
if(pWnd->GetDlgCtrlID() == IDD_BGCOLOR_DIALOG)
replace it simply with
if(pWnd == this)
Well, the reason is that you want to change the background color of dialog and GetDlgCtrlID returns the IDs of controls on the dialog not of dialog itself. You can check it simply by the if condition I have written above.
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
dear all,
OS: Windows XP/2k
I am developing an application running with service. can anybody tell how to add desciption to the service
(i.e in control panel display -> service description)
rohit
|
|
|
|
|
use ChangeServiceConfig2()
eg:
SERVICE_DESCRIPTION sdBuff;<br />
sdBuff.lpDescription = _T("This description is shown by SCM.");<br />
ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &sdBuff);<br />
suhredayan There is no spoon.
|
|
|
|
|
|
Hi,
How do I create a new window from an existing object that shares the original object instance ? I'll explain with an example.
Lets say you used IE to browse to a secure url that requires authorization.
After authorization, creating new window by using menu File->New Window gives you a new window that shares the authorization status. You don't have to login again in the new window.
How do I do it assuming I have CHtmlView ?
Thanks
|
|
|
|
|
Hi,
Can Anyone please suggest a Regular Expression which can validate an expression like "< 200",
"<= 200",
"> 200" or
">= 200"
Thanks a lot.
Amit
|
|
|
|
|
(>|>=|<|<=)\s?([0-9])+
\1 is the evaluation, \2 the number
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I want to determine, a file is text file or binary file(file name dosen't have file extension).Is there any API in Windows SDK?
Thanks
MJVALAN
|
|
|
|
|
You can open the file, read the contents, and examine the bytes to determine if the file contains any binary data. You can see if the characters are in the normal text range, as well as checking for CR/LF characters.
onwards and upwards...
|
|
|
|
|
A file is only "text" or "binary" in the context of the application that created it. Historically speaking, if the file contained non-printable characters, it was considered binary. Otherwise, it was considered text.
What exactly is it that you are trying to do?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I don't think so. This wouldn't make any sense to me. After all, a binary file appears as garbage in a text editor because the bytes will not map to ascii to form any kind of intelligible sentence in any language. The text editor doesn't care if the file you tell it to open is binary or not. It will just read the file and try to map the bytes into ascii and display whatever random characters the data happens to map to. If there were an automatic function for doing this, the people that wrote notepad and wordpad probably would have popped up an warning message reading, "warning, processing binary file"; or something like that.
All files are binary files, in my mind. It just so happens that a text file is a special kind of binary file where each byte maps to an appropriate ascii symbol to form intelligible letters/numbers/symbols. Even the carriage returns and line feeds are simply bytes of data that map to the appropriate ascii symbol. I think writing an algorithm to guess if something is good enough to be a text file would be awfully difficult if not impossible. You'd have to read each byte in and make a lot of assumptions about the data.
|
|
|
|
|
i have IPHelper demo.so,i'm running this demo,but to no avail.
following error is appear.
how can i run this demo.
stdafx.h(24) : fatal error C1083: Cannot open include file: 'Iphlpapi.h': No such file or directory
#include <iphlpapi.h>
#pragma comment(lib, "Iphlpapi.lib")
Iphelper ->http://www.codeproject.com/internet/IPHelper.asp
|
|
|
|
|
Have u tried to ask this question in this article's own forum....
Found on Bash.org
I'm going to become rich and famous after i invent a device that allows you to stab people in the face over the internet
My Articles
|
|
|
|
|
Search for Iphlpapi.h on your machine. Mine is in the \program Files\Microsoft SDK\include directory (your could be else where).
If it doesn't exist install Microsofts Platform SDK.
Then add the path for the file to the include paths for the project in question..
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|