How do I do that?
SJolly
Posts
-
USB driver -
USB driverHi all, I am trying to write a driver for a USB device. I have taken the following steps: > Built checked version of BulkUSB from DDK samples. > Adapted the .inf file provided with the sample so that the vendor and product id match those of the device I'm writing the driver for. > Installed the driver using the wizzard - this seems to work fine and the device is reported as working properly. However, no debug messages come out of the system, no matter what I do with the device (unplug/insert/attempt to connect etc). Can anyone see anything I may have missed? Thanks in advance, Simon
-
CPropertyPage / CPropertySheet problemSorry, my fault: I am now titled. :-D Thanks again, Simon
-
CPropertyPage / CPropertySheet problemYes - the knowledge base article helped and I am now sorted. ;) Thanks very much, Simon
-
CPropertyPage / CPropertySheet problemHi all, I have a set of property pages on a property sheet. I am trying to add a page to the sheet and change the title, but the title does not change. If I do: //AddPage(thepage); //SetActivePage(thepage); SetWindowText("TEST"); CString strTest; GetWindowText(strTest); Then strTest is changed to "TEST" correctly, but the text does not show up on the control. Am i missing something? Thanks and Regards, Simon
-
random numberYes, my bad - I forgot that the time bit was in seconds.
-
random numberThe numbers will be repeated in the same sequence only if you start two copies of the application at the same time - the numbers are psuedorandom. If that isn't good enough then you could seed the timer again each time you get a new random number - then differences such as the processor speed / load etc will mean that the sequence will definitely not be repeated. Regards, Simon
-
random numberThe output wouldn't be a random number as you are affecting the outcome, however to generate random numbers: // seed the random number generator using the current time srand((unsigned)time(NULL)); // gets a random number between 0 and 0x7fff int iRandom = rand(); // scale this number down to a value between 0 and 1000. iRandom /= (RAND_MAX / 1000); Regards, Simon
-
DLL Registration problemTry asking here: http://www.codeproject.com/script/comments/forums.asp?forumid=1644[^] Regards, Simon
-
How to control the connecting time in SOCKET?Before calling connect, add a call to set the socket up as non-blocking: ULONG ulParam = 1; ioctlsocket(m_hSocket, FIONBIO, &ulParam); Then call connect as normal. After calling connect, you can do a select (writing) with whatever timeout you want to see if the socket has connected - if the socket can be written to it is connected. Regards, Simon
-
ISDIGIT FunctionTry: if(isdigit(var1)) continue; in place of: if(var1 == isdigit) continue; Regards, Simon
-
mobile phone;) Do I need to buy a new laptop to go with that, or will the old one still work?
-
April 1st early this yearJust wait for the next version of IE, complete with the default security option of disabling all hyperlinks!
-
i want to get the handle of Dialog , that i created after clicking on a buttonHello, The handle is a member of the CDialog object - m_hWnd. I think this will be NULL until you have called the Create function on a modeless window. Regards, Simon
-
How to move Bitmap in Dialog ?If by DC, you mean device context, I am sorry but I don't know as much about this as I always use move window. However, I know to get the device context you would do: CDC * pDeviceContext = NULL; pDeviceContext = GetDlgItem(IDC_YOUR_CONTROL)->GetDC(); Then you'll have to look in the MSDN for a CDC function that moves the image. Regards, Simon
-
How to move Bitmap in Dialog ?In the handler for the button press, put something along these lines: RECT stNewPosition; // setup the new position for the bitmap (this can also resize it) stNewPosition.top = 50; stNewPosition.left = 50; // etc... // this moves the bitmap only GetDlgItem(IDB_YOUR_BITMAP)->MoveWindow(&stNewPosition, TRUE); I think you can move the image off your dialog with this - effectively making it vanish so beware. Regards, Simon
-
IP AddressSorry, yes you will definitely need the platform SDK. Regards, Simon
-
IP AddressHello, I've done this before using windows sockets. I don't know if it's the best way, but it definitely works: char szHostName[400]; struct hostent *hostinfo = NULL; IN_ADDR addr; char szIP[16]; // "xxx.xxx.xxx.xxx\0" ULONG ulIP = 0; // get the dns name as a string gethostname(szHostName, 400); // get the host info (contains ip address) hostinfo = gethostbyname(szHostName); if(hostinfo == NULL) { DWORD dwError = WSAGetLastError(); // handle the error } else { // get the ip as ULONG ulIP = *reinterpret_cast(hostinfo->h_addr_list[0]); // put the ip it into an IN_ADDR addr.S_un.S_addr = ulIP; // changes ip into string sprintf(szIP, "%s", inet_ntoa(addr)); TRACE("My IP address is %s\n", szIP); } Regards, Simon
-
Refreshing windows systrayHello, How are you removing the window - I have seen this problem before if you miss: Shell_NotifyIcon(NIM_DELETE, IconNotificationData); Without the above the notification gets sent when you put the mouse over the icon - making it vanish. Regards, Simon
-
How to get/set the position of buttons, ListCtrl etc.?Try: RECT stItemRect = {0}; GetDlgItem(IDC_NAME_OF_CONTROL)->GetWindowRect(&stItemRect); This ensures that you are using the correct CWnd item. It gives you all the corners of the item, so you can also work out the size. If this still crashes then I would guess the list control is being declared incorrectly - does it display on screen with those lines commented out? Simon.