|
legit wrote: Is USB just another serial device or does it require a special kind of communication?
No, USB doesn't work the same way as a serial port. Every USB device is shipped with a device driver. What you need to do is get a handle on this driver (with CreateFile) and then you'll be able to communicate with your device by sending IO codes to your driver (using DeviceIOControl) these codes should normally be documented with the driver (there are specific to your device).
Now, if the device you are using is a USB-to-serial module, then the driver simulate a COM port and you can use it the same way as a standard COM port.
|
|
|
|
|
Can you point me to the documentation for those functions ( CreateFile and DeviceIOControl)?
thanks
- legit
|
|
|
|
|
Anyone knows if and how I can hide my resources(like textures) in an executable file?
I mean if there is a way to hide my jpg file as a whole in an exe file
thanks in advance.
|
|
|
|
|
Lord_Vader wrote: Anyone knows if and how I can hide my resources(like textures) in an executable file?
I mean if there is a way to hide my jpg file as a whole in an exe file
you can use an exe protector like this http://www.codeproject.com/cpp/peprotector1.asp[^] it's simple but powerful!
Ali
|
|
|
|
|
Ali Mojtabaee wrote: uexe protector [...] it's simple but powerful!
Unless someone with knowledge scrutinizes your program.
These kind of software is like those stinging-insect repellants: Does not work 100%, and does only repell the harmless ones - those you could stand anyway.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hi!
I'm starting to write an application (c++, mfc of course ) that has the primary task to show data from a database. Actually it isn't my first application written in c++ that access to a database to read data but probably it will be the most complex. For this reason I was wondering if you have some advice about the design of this kind of applications... On top of my worries there is how to manage queries: I'm sure that in the future there will be a lot of changes so, probably, my usual way (simply build a class "around" the structure of recordset's query) to manage this things could be limited.
So my question: there is something similar to the data abastraction layer that .net provides but for unmanaged code? There are some rules/advices that I should know? Any links to turorials, books and so on it will be really apreciated
Regards,
Francesco
P.S. I'm sorry if this post isn't exactly on topic with the forum. If you think that another forum could be a better choice let me know and I will move the question there.
|
|
|
|
|
I want to display each of the below variables in a separate line in a list box. I know I can use a separate InsertString for each one. But I wonder if there is a format command I can put in the ComplMessage.Format that will cause each one to go to a new line. I have looked at the format directives for sprintf, but don't see anything obvious. But sometimes it just isn't obvious. Any ideas? Thanks.
ComplMessage.Format("%d %s %s %c %d@%.4s %8s %d/%d %7s %d-%s",
orderDetail.XrefP,
orderDetail.ContractName,
orderDetail.ContractDate,
orderDetail.BuyOrSell,
orderDetail.Lots,
orderDetail.Price,
orderDetail.OrderID,
orderDetail.AmountFilled,
orderDetail.NoOfFills,
orderDetail.AveragePrice,
orderDetail.Status,
StatLine);
pListBox->InsertString(0,ComplMessage);
|
|
|
|
|
You can use edit box with multi line to instead listbox
-----------------
Best Regards,
Le Thanh Cong
|
|
|
|
|
Oliver123 wrote: I have looked at the format directives for sprintf, but don't see anything obvious.
Any reason why you don't use \n in the format specifier?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I tried that. Also tried \n\r.
\n yields a bold vertical bar in the resulting single line of text.
\n\r yields two bold vertical bars.
|
|
|
|
|
Of course it does. What else would you expect it to display since a list control is not meant for multiple lines. If you must have multiple lines, use an edit control with the ES_MULTILINE style.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I guess I have been using the wrong tool for the job. The edit control works much better. Thanks.
|
|
|
|
|
Hi
This code closes the window with PostMessage.
But if i write SendMesssage instead of Post message it doesn't close the window.I don't understand why it is so.
HWND h=::FindWindow(NULL,L"Tutorial: A Simple Window - Mozilla Firefox"); <br />
PostMessage(h,WM_QUIT,0,0);
What are the differences so postmessage can close the window but postmessage can not.
Thanks
Edit/Delete Message
|
|
|
|
|
From MSDN 2005;
Do not post the WM_QUIT message using PostMessage; use the PostQuitMessage function.
Postmessage just dumps it in the queue, if it fails you miss the error it raises.
Sendmessage waits until it gets a return value.
Hope that helps
|
|
|
|
|
Check out the remarks section of the SendMessage() API. SendMessage Function[^] and how
it's handled across threads.
Across processes PostMessage is a better idea IMO. If you need to wait until it closes then
maybe wait until FindWindow() fails.
Mark
|
|
|
|
|
Posting a WM_CLOSE message is the right way to close a window. WM_QUIT will make the message loop stop right away, without giving the app the chance to properly shut down.
|
|
|
|
|
|
i know how to get the current time and date i need to know how to add 10 hours to it.
CTime t1;<br />
t1=CTime::GetCurrentTime();<br />
GetDlgItem(IDC_MINE)->SetWindowText(t1.Format("%A, %B %D, %y, %H:%M:%S"));
or if i knew how to set the timezone i could use another CTime and just use 2 for what i need and how to convert it to 12 hour format
ok i think i have it but i still dont know how to get it to 12 hour format.
-- modified at 15:00 Sunday 22nd October, 2006
|
|
|
|
|
Try %I instead of %H in the hour portion to get 12 hour format.
Jeron
|
|
|
|
|
thanks dude worked like a charm.
where can i find all the %H %I %P and so on in msdn?
|
|
|
|
|
|
CTime t1 = CTime::GetCurrentTime();
t1 += CTimeSpan(0,10,0,0);
|
|
|
|
|
that looks simple enough but i just used
CTime t2;<br />
t2=CTime::GetCurrentTime()+36000;
|
|
|
|
|
Hi, I'm using MSDN 2005. I have set up serialization of a list. If I use the open file command and try an reload a file that is already in memory, is does not enter into the ::Serialize(CArchive& ar). I'd like it to force a reload, as I have a separate function that imports a text file, and if I try reload a file that it thinks is in memory, but isn't, it doesn't work. Any help much appreciated.
Cheers
Colin
|
|
|
|
|
I have tried to lookup a conversion of a char to wchar_t, only found the other way around.
//my code
WCHAR* FileType;
char buffer[512];
ifstream inn;
inn.open("SkyWorld.ini");
string buffer1;
getline(inn, buffer1);
sprintf(buffer, "%s", buffer1.c_str());
// now buffer to FileType, or if possible, string to wchar_t so i can save 1 stepp.
thanks
|
|
|
|