|
Thank you very much ...
|
|
|
|
|
|
Thank you for your reply ...
|
|
|
|
|
hi!
i want a sample for USB working, sending and recieving data to USB port
thank you
Zo.Naderi-Iran
|
|
|
|
|
Working with a USB is not like working with a serial port. You can't simply open the port and read/write data. Instead you have to get a handle from a device driver that is supplied with the device you want to communicate to.
So in brief, you never access the port directly but a driver and you never 'know' that you in fact access the USB port through the driver. You simply communicate with a driver. To get the handle, you have to use CreateFile and once you have the handle, you can write or read data using WriteFile/ReadFile. You can exchange driver specific information using DeviceIOControl.
All of these things are very specific to the driver (and device) you are accessing. So, if you want to information, you will need to be much more specific and tell us which device you want to access.
|
|
|
|
|
for example, an USB hard lock.
Zo.Naderi-Iran
|
|
|
|
|
On Cedric's behalf:
You need to read his message again - look at the website for the supplier of the hard lock (whatever that is). Usb is NOT like the serial port, you talk via device drivers. So you need the information from the supplier of whatever the device is.
Iain.
|
|
|
|
|
Hey all..
I need to draw PNG and some text on windows startup or when someone lock the computer.. It's Non MFC application.. Can someone throw light on approach?? I'm actually blank in that.. Just the start.
Thanks all..
|
|
|
|
|
Let me rephrase the question.. How do i draw picture (BMP or PNG) on window screen. Not Dialog Box.
And without MFC..
Thanks.
|
|
|
|
|
|
Thanks for the link.. But i've trouble to change it on Win32.. Can someone redirects me to Non-MFC source code or tutorials regarding that..
Thanks..
|
|
|
|
|
You are not compelled to use of MFC on your program.
|
|
|
|
|
Sorry if i sound dumb.. But please bother with me..
I've one BMP and i need to draw the BMP (Transparent) on desktop screen not Dialog Box (Non-MFC).. How do i use the function given in the link to fulfill it...
Thank you..
|
|
|
|
|
Well you need to a handle to desktop window you can use of HWND m_hwndesktop= ::GetDesktopWindow(); and then you can use of your code.
|
|
|
|
|
I have a problem in reading numbers as "numbers" from a text file using getc...as it reads it as a character.
I am supposed to perform arithmetic operations on the numbers read from a text file.
The numbers are both of integer format and float format.
|
|
|
|
|
How are you reading the number?
In C you can use fscanf.
int x;
fscanf(fp, "%d", &x);
In C++ you can use fstream classes.
std::ifstream fp("filename");
int x;
fp >> x;
-Saurabh
|
|
|
|
|
You can read your values with CString class and then use of CString::Foramt or itoa.
|
|
|
|
|
I have listview in recordview mode . I want to move the position of the
row up and down the in the list view like in vc++ includedirectory path . where we can
easily move up and down the various include path . for which I am using two buttons one
for up and one for down.how it is possible.
Trioum
|
|
|
|
|
To move an item up, call GetNextItem(-1, LVNI_SELECTED) to get the index of the selected item. Call DeleteItem(nIndex). Call InsertItem(nIndex - 1) to insert the item back in the list control.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi,
I created an dialog application in SDK. Dialog does not contain any control. I tried to capture WM_KEYDOWN message, but not receiving this messaage. In MFC I can track this message in PreTranslateMessage but I do not know how to track in SDK. Any Idea please.
Thanks
|
|
|
|
|
|
BOOL CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL bResult = FALSE;
switch(uMsg)
{
case WM_INITDIALOG:
// implemention code;
bResult = TRUE;
break;
case WM_KEYDOWN:
// implemention code;
bResult = TRUE;
break;
}
return(bResult);
}
DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, DialogProc);
|
|
|
|
|
i wana to load a JPG file and render it on gui,but no any result however...and every time it prints: Render PIC SUC!! and i cannot resolve the problem,my code is:
void CTestLoadJPEGDlg::OnBtnNew()
{
CFileDialog cFileDlg( TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "File(*.JPEG;*.JPG;*.BMP)|*.JPEG;*.JPG;*.BMP||", NULL);
if (IDOK == cFileDlg.DoModal())
{
CString strPicFilePath;
strPicFilePath = cFileDlg.GetPathName();
TRACE("the file path:%s\n",strPicFilePath);
CFile cFile(strPicFilePath,CFile::modeRead);
int nPicFileBufSize = cFile.GetLength();
HGLOBAL hGlobal = ::GlobalAlloc(GMEM_MOVEABLE, nPicFileBufSize);
if(NULL != hGlobal)
{
LPVOID lpData = NULL;
lpData = ::GlobalLock(hGlobal);
if (NULL != lpData)
{
cFile.ReadHuge(lpData, nPicFileBufSize);
GlobalUnlock(hGlobal);
IStream *pIstream = NULL;
CreateStreamOnHGlobal(hGlobal,TRUE,&pIstream);
if (NULL != pIstream)
{
HRESULT hr = ::OleLoadPicture(pIstream, nPicFileBufSize, TRUE, IID_IPicture, (LPVOID*)&m_iPicture);
if (FAILED(hr))
{
TRACE("OleLoadPicture failed!!\n");
goto CLOSEFILE;
}
pIstream->Release();
}
}
else
{
TRACE("lpData=NULL!!!\n");
goto CLOSEFILE;
}
}
else
{
TRACE("hGlobal=NULL!!!\n");
goto CLOSEFILE;
}
if (NULL != m_iPicture)
{
CSize sizeInHimetric;
HRESULT hr = NULL;
hr = m_iPicture->get_Width(&sizeInHimetric.cx);
if (FAILED(hr))
{
TRACE("get_Width failed!!\n");
goto CLOSEFILE;
}
hr = m_iPicture->get_Height(&sizeInHimetric.cy);
if (FAILED(hr))
{
TRACE("get_Height failed!!\n");
goto CLOSEFILE;
}
HDC hDCScreen = ::GetDC(NULL);
int nPixelsPerInchX = ::GetDeviceCaps(hDCScreen, LOGPIXELSX);
int nPixelsPerInchY = ::GetDeviceCaps(hDCScreen, LOGPIXELSY);
::ReleaseDC(NULL, hDCScreen);
CSize sizeInPixel;
sizeInPixel.cx = MulDiv(sizeInHimetric.cx, nPixelsPerInchX, HIMETRIC_PER_INCH);
sizeInPixel.cy = MulDiv(sizeInHimetric.cy, nPixelsPerInchY, HIMETRIC_PER_INCH);
m_szPicPixel = sizeInPixel;
m_szPicHimetric = sizeInHimetric;
DrawPic();
}
CLOSEFILE:
cFile.Close();
}
return;
}
void CTestLoadJPEGDlg::DrawPic()
{
if (NULL == m_iPicture)
{
TRACE("m_iPicture=NULL!!\n");
return;
}
CRect rect;
m_staticPicRect.GetWindowRect(rect);
CPoint ptTopLeft;
ptTopLeft = rect.TopLeft();
float fZoomRate = 1.0;
int xSrcPos = (int)(ptTopLeft.x / fZoomRate);
int ySrcPos = (int)(ptTopLeft.y / fZoomRate);
int cxSrcWidth = (int)(rect.Width() / fZoomRate);
int cySrcHeight = (int)(rect.Height() / fZoomRate);
CDC* dc = GetDC();
int nPixelsPerInchX = ::GetDeviceCaps(*dc, LOGPIXELSX);
int nPixelsPerInchY = ::GetDeviceCaps(*dc, LOGPIXELSY);
int xHimetric = MulDiv(xSrcPos, HIMETRIC_PER_INCH, nPixelsPerInchX);
int yHimetric = MulDiv(ySrcPos, HIMETRIC_PER_INCH, nPixelsPerInchY);
int wHimetric = MulDiv(cxSrcWidth, HIMETRIC_PER_INCH, nPixelsPerInchX);
int hHimetric = MulDiv(cySrcHeight, HIMETRIC_PER_INCH, nPixelsPerInchY);
HRESULT hr = m_iPicture->Render(dc->GetSafeHdc(), rect.left, rect.top, rect.Width(), rect.Height(),
xHimetric, yHimetric, wHimetric, hHimetric, NULL);
if (FAILED(hr))
{
TRACE("Render failed!!\n");
return;
}
TRACE("Render PIC SUC!!\n");
}
thks again!
|
|
|
|
|
|
thanku! but could u tell me what is the problem in my codes?
|
|
|
|