|
if your's application is MFC based application, CDatabase class is there for manipulate database. If you wanna manipulate your database, you should make following steps..
1. Build ODBC connection string for SQL server for this refer to connectionstring.com
2. Create object for CDatabase
3. Using CDatabase::Open() function get connection to your database
4. Using CDatabase::ExecteSQL() run your insert query..
5. Finally close the connection CDatabase::Close()..
-suzuu
|
|
|
|
|
Hi all,
I am trying to communicate with HID Devices, but my problem is my ReadFile function always return zero.
I have written the code below
ReadHandle=CreateFile
(detailData->DevicePath,
GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE,
(LPSECURITY_ATTRIBUTES)NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
Result = ReadFile
(ReadHandle,
InputReport,
Capabilities.InputReportByteLength,
&NumberOfBytesRead,
(LPOVERLAPPED) &HIDOverlapped);
Before CreateFile i have used all the necessary api's to get the DevicePath value like SetupDiGetDeviceInterfaceDetail
Now, i am not getting that where is the problem.
Thanks in advance
|
|
|
|
|
From the documentation[^]:
If the function fails, or is completing asynchronously, the return value is zero (FALSE). To get extended error information, call the GetLastError function.
Note The GetLastError code ERROR_IO_PENDING is not a failure; it designates the read operation is pending completion asynchronously. For more information, see Remarks.
You are creating your ReadHandle with FILE_FLAG_OVERLAPPED , if you check GetLastError() after ReadFile , do you maybe get ERROR_IO_PENDING ?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Hi,
I have to find the status for a particular file which is currently copying some where or not? If anybody know any DOS commands or have any idea regarding this, please let me know.
Thanks in advance
Suzu
modified on Thursday, July 8, 2010 3:03 AM
|
|
|
|
|
Jack Torrance: | "When" do you think "maybe" he should be taken to a doctor? | Wendy Torrance: | As soon as possible. | Jack Torrance: | [mocking/imitating her] As soon as possible. |
PS: You removing the "ASAP" kind of spoilt the joke!
Steve
modified on Thursday, July 8, 2010 3:06 AM
|
|
|
|
|
|
meaooo...
|
|
|
|
|
Why do you want to know that? What for?
|
|
|
|
|
just i want to monitor particular file in windows...
|
|
|
|
|
So have you considered ReadDirectoryChangesW() or FindFirstChangeNotification() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi all,
Im having
char *data = new char[256];
if i use cstring like,
std::string logFolder;
CString temp1;
temp1.Format(L"%s",data);
USES_CONVERSION;
logFolder = T2A(temp1);
I am able to get the correct path from data.
If i use like,
std::string temp;
temp = (boost::format("%s") % data).str();
logFolder = temp;
i cant get the correct string from data..
Anyone knows how to format the char array?Is parsing needed?Pls help me.
Thanx..
|
|
|
|
|
Try boost::format("%1%") % data
|
|
|
|
|
Not working.Its also gives the first letter only..
Is any other syntax to display the char array in boost format??
Pls help me.
|
|
|
|
|
Oh! Yes of course.
You wchar_t instead of char .
|
|
|
|
|
It does not give the correct value..It gives some abnormal value.
|
|
|
|
|
This code works fine for me:
#include "stdafx.h"
#include <tchar.h>
#include <iostream>
#include <boost/format.hpp>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
using namespace boost;
const char *pData = "world";
format fmt("Hello %1%!");
fmt % pData;
cout << fmt;
cout << endl;
return 0;
}
The output is:
Hello world!
Steve
|
|
|
|
|
Stephen Hewitt wrote: The output is:
Hello world!
and there it is. You dropped the bomb...
|
|
|
|
|
I have created a list box using my own class derived from CListBox. I want to disapear it from the dialog if anyone is clicking outside that listbox. very similar to combobox.
Please help me to do that.. It will be fine if provide some sample code.
Thanks
|
|
|
|
|
Create a handler for WM_KILLFOCUS inside you're class and call ShowWindow(SW_HIDE) on the listbox handle.
|
|
|
|
|
That I hv done but its not closing.
Actually I am trying to create a dropdown Control. For that I created a button control derived from CButton and on click of that button control I am creating a listbox derived from CListBox. I am able to show and hide on the button click, even I am able to show and hide on listbox onselchange(), but I am not able to hide when I am clicking anywhere on the dialogbox.
is there any child and parent window problem ?
Thanks.
|
|
|
|
|
I'm guessing you're not getting the kill focus event.
That's probably because you're not setting focus to the list when shown.
|
|
|
|
|
Could you please tell me how and where to set the focus for the list box. Bcoz I m creatin List box on the click of button control.
|
|
|
|
|
You could try to call SetFocus after creating and showing the list box.
|
|
|
|
|
Hi I hv tried but its not working..
Here by I m sending my code , plz look into that..
// Here I am creating the button as well as ListBox. CTxDropDown is derived from CButton.
void CTxDropDown::CreateDropDown(CRect rect, CWnd *pWnd, UINT nID)
{
this->Create(L"", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON ,rect, pWnd, nID);
CRect m_rtBtn(rect);
m_rtLst.left = m_rtBtn.left + 2 ;
m_rtLst.top = m_rtBtn.top + 38 ;
m_rtLst.right = m_rtBtn.right - 2 ;
m_rtLst.bottom = m_rtBtn.bottom + 120 ;
m_lstCtrl.CreateListBox(m_rtLst , pWnd , this , nID);
m_lstCtrl.SetItemHeight(0, 25);
m_lstCtrl.AddString(L" ENGLISH");
m_lstCtrl.AddString(L" JAPANIES");
m_lstCtrl.AddString(L" FRENCH");
m_lstCtrl.AddString(L" GERMAN");
m_lstCtrl.ShowWindow(SW_HIDE);
}
// On button click I m showing the and hiding the ListBox. m_lstCtrl is the object of my listbox class
void CTxDropDown::OnBnClicked()
{
// TODO: Add your control notification handler code here.
m_lstCtrl.SetFocus();
m_bShowListCtrl = !m_bShowListCtrl;
m_lstCtrl.ShowWindow(m_bShowListCtrl );
Invalidate();
}
// Here I am creating the ListBox.CTxListControl is derived froom CListBox.
void CTxListControl::CreateListBox(CRect rect,CWnd *pWnd,CWnd *pDropDownWnd ,UINT nID)
{
this->Create(WS_VISIBLE |WS_CHILD|WS_VSCROLL|LBS_NOTIFY| LBS_HASSTRINGS | WS_TABSTOP ,rect , pWnd , nID);
this->SetFocus();
m_pDropDownWnd = pDropDownWnd;
m_rtLst = rect ;
}
// Calling the KillFocus on ClistBox
void CTxListControl::OnLbnKillfocus()
{
// TODO: Add your control notification handler code here
CListBox::ShowWindow(SW_HIDE);
}
Plz look the code..
and Gv some idea where I m worng..
|
|
|
|
|