|
With all of the examples available on MSDN and Google, what specifically is giving you grief?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Did you look at these examples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlconnect.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlbindcol.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlgetdata.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcconnecting_with_sqlconnect.asp
http://publib.boulder.ibm.com/infocenter/db2help/index.jsp?topic=/com.ibm.db2.udb.doc/ad/samples/cli/s-dbmcon-c.htm
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Under the odbcsqlconnect.asp I copied this sample code, but it give me 9 Errors. Some others do not have samples. I get a lot of errors including any SQLxx.h files.
SQLHENV henv;
SQLHDBC hdbc;
SQLHSTMT hstmt;
SQLRETURN retcode;
/*Allocate environment handle */
retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Set the ODBC version environment attribute */
retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Allocate connection handle */
retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Set login timeout to 5 seconds. */
SQLSetConnectAttr(hdbc, (void*)SQL_LOGIN_TIMEOUT, 5, 0);
/* Connect to data source */
retcode = SQLConnect(hdbc, (SQLCHAR*) "TEST", SQL_NTS,
(SQLCHAR*) "tUser", SQL_NTS,
(SQLCHAR*) "tPass", SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO){
/* Allocate statement handle */
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Process data */
// ;
// ;
// ;
//
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
}
SQLDisconnect(hdbc);
}
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
}
}
SQLFreeHandle(SQL_HANDLE_ENV, henv);
}
|
|
|
|
|
WinAPILearner wrote:
...but it give me 9 Errors.
And those errors would be?
WinAPILearner wrote:
Some others do not have samples.
All of the links I provided have examples.
WinAPILearner wrote:
I get a lot of errors including any SQLxx.h files.
What are they?
How are you using this code snippet? What other .h files have you included?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
following is my implimentation
#include <windows.h>
#include <odbcinst.h>
#include <sqldb.h>
............ Other codes
void FillListBox (HWND hwndList)
{
SQLHENV henv;
SQLHDBC hdbc;
SQLHSTMT hstmt;
SQLRETURN retcode;
/*Allocate environment handle */
retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Set the ODBC version environment attribute */
retcode = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Allocate connection handle */
retcode = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Set login timeout to 5 seconds. */
SQLSetConnectAttr(hdbc, (void*)SQL_LOGIN_TIMEOUT, 5, 0);
/* Connect to data source */
retcode = SQLConnect(hdbc, (SQLCHAR*) "TEST", SQL_NTS,
(SQLCHAR*) "tUser", SQL_NTS,
(SQLCHAR*) "tPass", SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO){
/* Allocate statement handle */
retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
/* Process data */
//SendMessage (hwndList, LB_ADDSTRING, 0, (LPARAM) "TEST") ;
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
}
SQLDisconnect(hdbc);
}
SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
}
}
SQLFreeHandle(SQL_HANDLE_ENV, henv);
}
:\program files\microsoft visual studio\vc98\include\sqldb.h(56) : error C2143: syntax error : missing ')' before '*'
e:\program files\microsoft visual studio\vc98\include\sqldb.h(56) : error C2143: syntax error : missing ';' before '*'
e:\program files\microsoft visual studio\vc98\include\sqldb.h(56) : error C2059: syntax error : ')'
e:\program files\microsoft visual studio\vc98\include\sqldb.h(56) : error C2061: syntax error : identifier 'PDBPROCESS'
e:\program files\microsoft visual studio\vc98\include\sqldb.h(56) : error C2501: 'DBERRHANDLE_PROC' : missing storage-class or type specifiers
e:\program files\microsoft visual studio\vc98\include\sqldb.h(57) : error C2226: syntax error : unexpected type 'SQLAPI'
e:\program files\microsoft visual studio\vc98\include\sqldb.h(59) : error C2146: syntax error : missing ';' before identifier 'SQLAPI'
e:\program files\microsoft visual studio\vc98\include\sqldb.h(59) : error C2373: 'DBERRHANDLE_PROC' : redefinition; different type modifiers
e:\program files\microsoft visual studio\vc98\include\sqldb.h(56) : see declaration of 'DBERRHANDLE_PROC'
e:\program files\microsoft visual studio\vc98\include\sqldb.h(59) : fatal error C1004: unexpected end of file found
Error execu
|
|
|
|
|
You must include sqlfront.h before sqldb.h .
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
e:\program files\microsoft visual studio\vc98\include\sqlfront.h(126) : error C2146: syntax error : missing ';' before identifier 'LPINT'
e:\program files\microsoft visual studio\vc98\include\sqlfront.h(126) : error C2040: 'PTR' : 'int' differs in levels of indirection from 'void *'
e:\program files\microsoft visual studio\vc98\include\sqlfront.h(126) : fatal error C1004: unexpected end of file found
Now geting 3 Errors in sqlfront.h
|
|
|
|
|
In what order do you have the #include statements?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I am writing a program that runs another program and prints the second program's output in first's console, but the second program's output is printed before output in the first program.
Here's my code
<br />
#include <windows.h><br />
#include <tchar.h><br />
#include <iostream.h><br />
<br />
void main(void)<br />
{<br />
PROCESS_INFORMATION pi;<br />
STARTUPINFO si;<br />
<br />
ZeroMemory(&si,sizeof(STARTUPINFO));<br />
si.cb = sizeof(STARTUPINFO);<br />
<br />
cout << _T("Starting ver...\n");<br />
<br />
if(CreateProcess(NULL, _T("cmd /c ver"), NULL, NULL,<br />
TRUE, 0, NULL, NULL, &si, &pi))<br />
{ <br />
DWORD ExitCode = 0;<br />
DWORD ErrorCode = 0;<br />
<br />
do<br />
{<br />
Sleep(100);<br />
if(GetExitCodeProcess(pi.hProcess, &ExitCode) == 0)<br />
{<br />
cout << _T("GetExitCodeProcess Error: ");<br />
cout << GetLastError() << endl;<br />
}<br />
}while(ExitCode == STILL_ACTIVE);<br />
<br />
CloseHandle(pi.hThread);<br />
} <br />
cout << _T("Finsihed with ver\n");<br />
}
and here is the program output
Microsoft Windows XP [Version 5.1.2600]
Starting ver...
Finsihed with ver
The program should output "Starting ver..." before it runs version. The output doen't change if I use printf instead of cout either.
Does anybody know of a solution? It has me stumped.
Thanks in advance.
-Joe
|
|
|
|
|
cout buffers the data before it writes it to the screen. Try using cout.flush() before creating the process to force the buffer to be written to the screen immediately.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks that fixed the problem.
|
|
|
|
|
That is truly the stupidest thing I ever heard. If an OS is only for programmers, what programs will you write under it, and who will use them ? There's nothing so wrong with Windows ( or Linux for that matter ) that you and your team are likely to fix it. Your best bet would probably be to hack a linux distro to do what you and the 3 other people who will use it want from it.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I want to write a skinnable scrollbar, I need hook system scrollbar group API, how can I do that?
I can hook these API called from my process, bu if I process call comctl32.dll and comctl32.dll call these API, I can hook it? How can I hook these API called in comctl32.dll? any demo code will helpful.
|
|
|
|
|
http://www.codeproject.com/dll/apihijack.asp
I don't know if this works on 9x-based OS, though
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I want to hook COMCTL32.DLL's import function table or I want to replace the GetScrollBarInfo API 's enter address in user32.dll , because win98 share system DLL in the same address space and protect it, how can I do this??
==============================================
SkinMagic SDK Library for C/C++
The better solution for write skinnable application
http://www.appspeed.com
==============================================
|
|
|
|
|
there is very good example in system section for system wide Hooks including 9x.i think this may help
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I want to hook COMCTL32.DLL's import function table or I want to replace the GetScrollBarInfo API 's enter address in user32.dll , because win98 share system DLL in the same address space and protect it, how can I do this??
==============================================
SkinMagic SDK Library for C/C++
The better solution for write skinnable application
http://www.appspeed.com
==============================================
|
|
|
|
|
i m developing a small telephony app usig TAPI. to intitialoze tapi i have to get ITTAPI ptr.
ITTAPI *gpTapi;
HRESULT res = CoInitialize(NULL);
CoCreateInstance(CLSID_TAPI,NULL,CLSCTX_INPROC_SERVER,IID_ITTAPI,(LPVOID *)&gpTapi);
gpTapi->Initialize();
i have added tapi3.h and also give link to Uuid.lib. At compile time it gives no error but at link time it gives error "unresolved symbol _CLSID_TAPI" and same error for "IID_ITTAPI". any one hav idea wats hapening. how can i find CLSID for TAPI and IID for ITTAPI. plz help
|
|
|
|
|
|
how to enable a system menu again from another class
this part works fine ...
void Cfirstw32mfcDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDHtmlDialog::OnSysCommand(nID, lParam);
}
if ((nID & 102) == IDS_ZONENAME)
{
CAddzonename* pDialog;
pDialog = NULL;
pDialog = new CAddzonename(this);
if(pDialog != NULL)
{
BOOL ret = pDialog->Create();
if (ret)
{
EDIT2 =("done");
UpdateData(FALSE);
CMenu* pSysMenu = GetSystemMenu(FALSE);
pSysMenu->EnableMenuItem(IDS_ZONENAME,MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
}
if(!ret) //Create failed.
AfxMessageBox("Error creating Dialog");
pDialog->ShowWindow(SW_SHOW);
}
else
AfxMessageBox("Error Creating Dialog Object");
//CAddzonename dlgAbout;
//dlgAbout.DoModal();
}
else
{
CDHtmlDialog::OnSysCommand(nID, lParam);
}
}
..........................................................
doesn't work, but doesn't return errors either
void CAddzonename::OnBnClickedOk()
{
/*Cfirstw32mfcDlg**/ CMenu* pSysMenu = GetSystemMenu(FALSE);
pSysMenu->EnableMenuItem(IDS_ZONENAME,MF_ENABLED);
DestroyWindow();
}
how do i enable the the menu item again, witch got disabled by pressing on it
kind regards,
marco
|
|
|
|
|
HRESULT Cfirstw32mfcDlg::OnButtonOK(IHTMLElement* /*pElement*/)
{
UpdateData(TRUE);
if(( EDIT1 == "" )&&( EDIT2 == "" ))
{
AfxMessageBox("You must provide a username and a password or click Cancel",MB_ICONSTOP);
return NULL;
}
AfxGetApp()->WriteProfileString("Settings", "email", EDIT1);
AfxGetApp()->WriteProfileString("Settings", "password", EDIT2);
//CAddzonename* m_Zonename;
//LPCTSTR m_Zonename = m_Zonename;
/*
if(m_Zonename)
{
AfxGetApp()->WriteProfileString("Settings", "Zonename", m_Zonename);
}
*/
return 0;
}
.......................................................
// CAddzonename dialog header file
class CAddzonename : public CDialog
{
DECLARE_DYNAMIC(CAddzonename)
public:
// global variable
CString m_Zonename;
.......................................................
i have tried this this ...
CAddzonename* m_Zonename;
CString m_Zonename2 = m_Zonename;
if(m_Zonename2)
{
AfxGetApp()->WriteProfileString("Settings", "Zonename", m_Zonename2);
}
and return this ...
j:\Visual Studio Projects\win32\firstw32mfc2\firstw32mfcDlg.cpp(222) : error C2440: 'initializing' : cannot convert from 'CAddzonename *' to 'ATL::CStringT<basetype,stringtraits>'
with
[
BaseType=char,
StringTraits=StrTraitMFC<char>
]
No constructor could take the source type, or constructor overload resolution was ambiguous
what am i doing wrong?
kind regards,
marco
|
|
|
|
|
Natural_Demon wrote:
AfxGetApp()->WriteProfileString("Settings", "Zonename", m_Zonename2);
I'm assuming that your application overrides WriteProfileString to take a CAddzonename pointer. AfxGetApp will return an instance of the base class, you need to cast it to the specialised class that contains this method. as it stands, it's trying to call the base class method, as that's all it can see.
I think. It's kind of hard to wade through all of that badly formated code.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
//CAddzonename* m_Zonename; <-- seems to be good, but how to use it??
if(m_Zonename)
{
AfxGetApp()->WriteProfileString("Settings", "Zonename", m_Zonename);
}
returns ...
j:\Visual Studio Projects\win32\firstw32mfc2\firstw32mfcDlg.cpp(224) : error C2065: 'm_Zonename' : undeclared identifier
BTW, i tried that before
Bad = knowing 2 much
|
|
|
|
|
That's a whole different problem. m_Zonename does not exist in the class where you're trying to use it, obviously.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
how smart u are, i found that also out, but what do i need or can i do about it??
Bad = knowing 2 much
|
|
|
|
|