|
I see you ignored all I asked and said.
If I understood what you meant correctly, then:
the LSB value is 360/0x10000 (approx 0.00549)
assuming a monotonous binary representation (as opposed to e.g. sign+mantissa), we get:
0x7FFF = almost 180
0x0000 = 0
0x8000 = -180
3.45 --> 3.45*0x10000/360 = 628 = 0x0274
-3.45 --> -3.45*0x10000/360 = -628 = 0xFD8C
|
|
|
|
|
Sorry Luc, as you may have noticed I am getting more confused, but think getting there from your last post.
One field in this array was height which ranged from 0 to 10,000, but the LSB was 0.5, and the sign not used; e.g. bit 15 was data.
So if you had 0000 0000 0000 1000 which is 8 then that represented 4 meters. I got this working and then turned to see why the heading and lat/long were not!
But with heading which did use the sign and had a range of -1 to +1 and a very small LSB.
May next question is are they a formula to handle these types of conversions. Just for a Windows platforn with the VS environment.
Still need to sort out the two unsigned short Lat and Long.
|
|
|
|
|
I have link: http://site/request.php?345923489
Please help me on MFC.
|
|
|
|
|
See here."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,
I'm using customized CTreeCtrl for drag and drop operation.
When drag an item with image from one tree to the another tree how can i copy image
i am using DropTarget inherited from COleDropTarget.
How can i get my drop window point there in my drop target.
void CDragDropTreeCtrl::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
HTREEITEM hTSelItem = pNMTreeView->itemNew.hItem;
m_hDragItem = hTSelItem;
SelectItem(hTSelItem);
Select(hTSelItem, TVGN_DROPHILITE);
if(m_pDragImage)
delete m_pDragImage;
m_pDragImage = CreateDragImage(hTSelItem);
ASSERT(m_pDragImage);
VERIFY (m_pDragImage->BeginDrag (0, CPoint (8, 8)));
VERIFY (m_pDragImage->DragEnter (GetDesktopWindow (), ((NM_TREEVIEW *)pNMHDR)->ptDrag));
m_bDragging = TRUE;
m_hDropItem = NULL;
m_nDropIndex = -1;
m_pDropWnd = this;
SetCapture();
COleDataSource *poleSourceObj = new COleDataSource ;
CTreeDropTarget::m_shWndTreeCtrl = m_hWnd;
DROPEFFECT dropeffect = poleSourceObj->DoDragDrop();
SendMessage(TVM_SELECTITEM, TVGN_DROPHILITE,0);
if ( dropeffect == DROPEFFECT_MOVE)
DeleteItem(hTSelItem);
delete poleSourceObj;
*pResult = 0;
}
void CDragDropTreeCtrl::MouseMove(CPoint point)
{
if(m_bDragging)
{
CPoint pt (point);
ClientToScreen (&pt);
VERIFY (m_pDragImage->DragMove (pt));
VERIFY (m_pDragImage->DragShowNolock (FALSE));
CWnd* pDropWnd = WindowFromPoint (pt);
ASSERT (pDropWnd);
if (pDropWnd != m_pDropWnd)
{
if (m_hDropItem)
{
((CDragDropTreeCtrl*)m_pDropWnd)->SelectDropTarget(NULL);
m_hDropItem = NULL;
}
}
m_pDropWnd = pDropWnd;
pDropWnd->ScreenToClient (&pt);
VERIFY (m_pDragImage->DragShowNolock (TRUE));
}
}
void CTreeDropTarget::OnDragLeave( CWnd* pWnd )
{
m_pDestTreeCtrl = (CDragDropTreeCtrl *)pWnd;
m_pDestTreeCtrl->m_bDragging = true;
m_pSourceTreeCtrl->m_bDragging = false;
m_pDestTreeCtrl->m_pDragImage = m_pSourceTreeCtrl->m_pDragImage;
m_pDestTreeCtrl->SendMessage(TVM_SELECTITEM, TVGN_DROPHILITE,0);
}
DROPEFFECT CTreeDropTarget::OnDragOver( CWnd* pWnd, COleDataObject* pDataObject,
DWORD dwKeyState, CPoint point )
{
DROPEFFECT dropeffectRet = DROPEFFECT_COPY;
if ( (dwKeyState & MK_SHIFT) == MK_SHIFT)
dropeffectRet = DROPEFFECT_MOVE;
m_pDestTreeCtrl = (CDragDropTreeCtrl *)pWnd;
m_pDestTreeCtrl->m_pDropWnd = (CDragDropTreeCtrl *)pWnd;
m_pSourceTreeCtrl->MouseMove(point);
HTREEITEM hTItem = m_pDestTreeCtrl->HitTest(point);
if ( hTItem != NULL )
{
m_pDestTreeCtrl->Expand(hTItem, TVE_EXPAND);
m_pDestTreeCtrl->SelectDropTarget(hTItem);
}
CRect rectClient;
pWnd->GetClientRect(&rectClient);
pWnd->ClientToScreen(rectClient);
pWnd->ClientToScreen(&point);
int nScrollDir = -1;
if ( point.y >= rectClient.bottom - RECT_BORDER)
nScrollDir = SB_LINEDOWN;
else
if ( (point.y <= rectClient.top + RECT_BORDER) )
nScrollDir = SB_LINEUP;
if ( nScrollDir != -1 )
{
int nScrollPos = pWnd->GetScrollPos(SB_VERT);
WPARAM wParam = MAKELONG(nScrollDir, nScrollPos);
pWnd->SendMessage(WM_VSCROLL, wParam);
}
nScrollDir = -1;
if ( point.x <= rectClient.left + RECT_BORDER )
nScrollDir = SB_LINELEFT;
else
if ( point.x >= rectClient.right - RECT_BORDER)
nScrollDir = SB_LINERIGHT;
if ( nScrollDir != -1 )
{
int nScrollPos = pWnd->GetScrollPos(SB_VERT);
WPARAM wParam = MAKELONG(nScrollDir, nScrollPos);
pWnd->SendMessage(WM_HSCROLL, wParam);
}
return dropeffectRet;
}
|
|
|
|
|
Did you try DragEnter(NULL, ..) ? Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
Yes i tried that but have same issue there.
|
|
|
|
|
OK.
(May be other windows do not know how to draw it...)
Would you set another application cursor instead ? Check your definition of Irrationality[ ^]
1 - Avicenna
5 - Hubbard
3 - Own definition
|
|
|
|
|
m_pDestTreeCtrl->m_pDragImage = m_pSourceTreeCtrl->m_pDragImage;
is it ok??
If you find any useful link pls give it to give me..
|
|
|
|
|
Hi,
My application exe is not working on another machine (XP), when I try to launch It displays error like:
CreateProcess failed;code 14001
The application failed to start because the application configuration file is incorrect. Reinstalling the application may fix the problem.
What configuration has to set?
|
|
|
|
|
Did u gaive the MFC option as "Use MFC in a Static Library" and build your application. Just check ( [^]) Величие не Бога может быть недооценена.
|
|
|
|
|
its a win32 application (windows)
|
|
|
|
|
Just build the application with the configuration mentioned above. Величие не Бога может быть недооценена.
|
|
|
|
|
Possibly you have to run this [^] on the target machine.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Just reinstall the vc software.
|
|
|
|
|
Do you really think it would be the solution: installing,for instance, Visual C++ on every customer machine? 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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
How can I add word wrap to this code for drawing text:
CPaintDC dc(this);
CRect r;
GetClientRect(&r);
Gdiplus::Graphics* g = Gdiplus::Graphics::FromHDC(dc.m_hDC);
CString txt;
GetWindowText(txt);
Gdiplus::Font myFont(m_FontName, m_FontSize, m_FontStyle);
Gdiplus::StringFormat format;
Gdiplus::RectF rf;
g->MeasureString(txt, txt.GetLength(), &myFont, Gdiplus::PointF(r.left, r.top), &rf);
Gdiplus::Color color;
color.SetFromCOLORREF(m_Color);
Gdiplus::SolidBrush whiteBrush(color);
g->DrawString(txt, txt.GetLength(), &myFont,
rf, &format, &whiteBrush);
g->Flush();
delete g; There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Graphics.DrawString takes a bounding rectangle, give it the maximum width you want, and sufficient height.
Graphics.MeasureString will calculate the required height when given the (same) maximum width.
|
|
|
|
|
Thanks There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
you're welcome.
|
|
|
|
|
Hey ,
i study technical computer science and now i want to start with my first driver under WINXP and WINDDK.
I have written two programs to display all connected devices to the computer and a real life detection of adding and removing to the system on two different ways.
/***************/
first:
i build a console application like "usb view" from microsoft to list all devices connected to the pc. After detecting the descriptor i want to start with reading and writing.
To get the usb device i used the IOCTL commands from <a href="http://msdn.microsoft.com/en-us/library/aa476229.aspx">http://msdn.microsoft.com/en-us/library/aa476229.aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/aa476229.aspx" target="_blank" title="New Window">^</a>]
1.) detect host controller (worked)
2.) connect to root hub (worked)
3.) list all ports and connected devices (worked)
4.) fill structe with device desciptor and more
usefull data with this code
IOCTL_USB_GET_NODE_CONNECTION_INFORMATION (worked)
5.) create handle to usb device (problems)
i dont know on which way i can detect the full device path like
\\\\?\\USB#Vid_####&Pid_#####879fe23a000000e83230303630313130#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
or detect a direct handle, i have only the handle to the root hub and the port number.
this is my structure
------------------------------------------
<code>
typedef struct _USB_DEVICES {
HANDLE hDeviceHandle; //RotHubHandle
HANDLE hUSBDeviceHandle; //USBDeviceHandle -> ???
DWORD dwPort; //Port
UCHAR CurrentConfigurationValue;
UCHAR DeviceAddress[2];
UCHAR NumberOfOpenPipes[4];
UCHAR ConnectionStatus[4];
BOOLEAN LowSpeed;
BOOLEAN DeviceIsHub;
USB_PIPE_INFO PipeList[32];
USB_DEVICE_DESCRIPTOR DeviceDescriptor;
USB_CONNECTION_STATUS DeviceStatus;
USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor;
USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;
} Ts_UsbDevices;
</code>
------------------------------------------
and now my code
------------------------------------------
<code>
......
//get information aber the connected device connected on "dwPort"
ConnectionInformation.ConnectionIndex = s_UsbDevice[dwActiveDevice].dwPort;
bSuccess = DeviceIoControl(s_UsbDevice[dwActiveDevice].hDeviceHandle, -> RootHubHandle
IOCTL_USB_GET_NODE_CONNECTION_INFORMATION,
&ConnectionInformation,
sizeof(ConnectionInformation),
&ConnectionInformation,
sizeof(ConnectionInformation),
&dwBytesReturned,
NULL);
if(bSuccess)
{
// get DeviceName or Handle to start with reading and writing
...
}
</code>
------------------------------------------
i dont know which IOCTL i have to use or on which way i can try to implement some read and wirte functions...
after this problems i checked the internet and found the SetupDi functions and that was the reasen why i started to write a seccond programm
/***************/
seccond:
like the first programm, i build a console application which list all devices. With this function i can detect the device path to create a handle
1.) get all connected devices with SetupDiGetClassDevs() (worked)
2.) get inferfaces with SetupDiEnumDeviceInterfaces() (worked)
3.) get interface details with SetupDiGetInterfaceDeviceDetail() (worked)
4.) CreateFile / DeviceIoControl failed (problems)
i have 3 devices connected to my computer via usb (keyboard, mouse, mtp device (iriver clix), when i tried to create a hanlde to the mouse and keyboard i get this message:
ERROR_GEN_FAILURE 31 (0x1F) - A device attached to the system is not functioning.
ok.. i found out, that microsoft has blocked this devices.. no problem... i dont want to use this.
Then i create a handle to the mtp device and their i have at first no problem. (no error code)
then i tried to test a lot a IOCTL codes with DeviceIoControl to get somme information or to read but erverytime i get the same error message (ERROR_GEN_FAILURE)
i looked in the internet and a lot of people do it on the same way and have no problem. i dont know whats going wrong.
------------------------------------------
<code>
#include <stdio.h>
#include <windows.h>
#include <setupapi.h>
#include <devguid.h>
#include <regstr.h>
#include "initguid.h"
static GUID GUID_DEVINTERFACE_USB_DEVICE = { 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } };
int main( int argc, char *argv[ ], char *envp[ ] )
{
//HidD_GetHidGuid(&GUID);
DWORD i;
DWORD InterfaceNumber= 0;
HDEVINFO hDevInfo;
SP_DEVINFO_DATA DeviceInfoData;
SP_DEVICE_INTERFACE_DATA DeviceInterfaceData;
struct _GUID GUID = GUID_DEVINTERFACE_USB_DEVICE;
// Create a HDEVINFO with all present devices.
hDevInfo = SetupDiGetClassDevs(&GUID_DEVINTERFACE_USB_DEVICE,NULL,NULL,DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (hDevInfo == INVALID_HANDLE_VALUE)
{
// Insert error handling here.
return 1;
}
// Enumerate through all devices in Set.
DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i,&DeviceInfoData);i++)
{
DWORD DataT;
LPTSTR buffer = NULL;
DWORD buffersize = 0;
while (!SetupDiGetDeviceRegistryProperty(hDevInfo,&DeviceInfoData,SPDRP_LOCATION_INFORMATION ,&DataT,(PBYTE)buffer,buffersize,&buffersize))
{
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
// Change the buffer size.
if (buffer) LocalFree(buffer);
buffer = (LPTSTR)LocalAlloc(LPTR,buffersize);
}
else
{
// Insert error handling here.
break;
}
}
if(buffer != NULL)
{
printf("\nDevice Number %i is: %ws",i, buffer);
InterfaceNumber = 0; // this just returns the first one, you can iterate on this
DeviceInterfaceData.cbSize = sizeof(DeviceInterfaceData);
if (SetupDiEnumDeviceInterfaces(hDevInfo,&DeviceInfoData,&GUID,InterfaceNumber,&DeviceInterfaceData))
{
DWORD needed;
SetupDiGetInterfaceDeviceDetail(hDevInfo, &DeviceInterfaceData,NULL, 0, &needed, NULL);
PSP_INTERFACE_DEVICE_DETAIL_DATA detail = (PSP_INTERFACE_DEVICE_DETAIL_DATA) malloc(needed);
if (detail)
{
// fill the device details
detail->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA);
if (SetupDiGetInterfaceDeviceDetail(hDevInfo,&DeviceInterfaceData,detail, needed,NULL, NULL))
{
OpenDevice(detail->DevicePath));
}
}
}
else
{
printf("\n\nNo interface");
}
}
if (buffer) LocalFree(buffer);
}
if ( GetLastError()!=NO_ERROR && GetLastError()!=ERROR_NO_MORE_ITEMS )
{
// Insert error handling here.
return false;
}
// Cleanup
SetupDiDestroyDeviceInfoList(hDevInfo);
getchar();
return 0;
}
void OpenDevice(CHAR DevicePath)
{
HANDLE hUSBDevice = CreateFile(DevicePath,
GENERIC_READ || GENERIC_WRITE,
FILE_SHARE_READ || FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
if(hUSBDevice != INVALID_HANDLE_VALUE)
{
// get pipe configuration
bSuccess = DeviceIoControl(s_UsbDevice->hUSBDevice,
IOCTL_GET_PIPE_CONFIGURATION, NULL,
0, &sUSBPipeInformation, sizeof(sUSBPipeInformation),
&dwBytesReturned,NULL);
if(!bSuccess)
{
//mpt device failed here
// print error message
USB_HW_ErrMsg();
}
}
else
{
//KeyBoad and Mouse failed here
}
}
</code>
------------------------------------------
i hope you can help me.
best regards
|
|
|
|
|
Hai,
I am having a C++ exe. I want to connect the exe to a databse that is present in another computer(server) and get images from that system.How I can accomplish this?
Thanks,
|
|
|
|
|
What sort of database are the images stored in?"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,
Could any one tell me the Difference between AVIStreamWrite and AVIStreamWriteData?
Thanks
|
|
|
|
|