|
I don't really care about the keyboard LED. I really just want a way to tell when the caps lock button has been pressed.
Is there any way to do that?
|
|
|
|
|
forrestcupp wrote: I really just want a way to tell when the caps lock button has been pressed.
Is there any way to do that?
Yes, but not cross-platform.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
i have a byte array in a string that i read from a resource
i used CString for example , i can use any other string types
i want to convert a comma delimited byte array string
CString stringarr = "5,10,15,20,25";
to unsigned char[]
unsigned char myarray[]={5,10,15,20,25};
i tried some for loop but result is always different than actual data
maybe i am doing something wrong with that
can you help me please
thanks.
|
|
|
|
|
You should take a look at the strtok_s[^] function. There's even a very similar example as yours.
|
|
|
|
|
Have also a look at CString::Tokenize method [^].
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 to add codepage 936 in VC++ ?
|
|
|
|
|
How about _setmbcp(936) ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi,
I am getting a problem with the CComboBox::GetItemDataPtr function
i have the following code
TCHAR *szFilePath = new TCHAR[MAX_PATH + 1];
ZeroMemory(szFilePath ,MAX_PATH);
_tcscpy(szFilePath ,_T("C:\Documents and Settings\user\Desktop\Scrollbar.xml"));
int nIndex = m_Combo.AddString(_T("ScrollBar"));
m_Combo.SetItemDataPtr(n , szFilePath);
using the Above code am setting the ItemDataPtr to a Buffer.
On the Selection change event of ComboBox
i have the following code
void CRegDlg::OnCbnSelchangeCombo()
{
// TODO: Add your control notification handler code here
int nIndex = m_Combo.GetCurSel();
void *szFilePath = m_Combo.GetItemDataPtr(n);
}
but the GetItemDataPtr() in OnCbnSelchangeCombo always returns a Bad
pointer. I don't know what is the actual problem with my code. Is there anything i want to do to get the actual buffer from void*.
thanks
Nitheesh
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
Nitheesh George wrote: _tcscpy(szFilePath ,_T("C:\Documents and Settings\user\Desktop\Scrollbar.xml"));
Are you intentionally not using double backslashes?
Nitheesh George wrote: m_Combo.SetItemDataPtr(n , szFilePath);
Shouldn't this be:
m_Combo.SetItemDataPtr(nIndex, szFilePath);
Nitheesh George wrote: void *szFilePath = m_Combo.GetItemDataPtr(n);
Shouldn't this be:
TCHAR *szFilePath = m_Combo.GetItemDataPtr(nIndex);
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi David,
thank you for your reply. Now i realize what is wrong with my code.
thanks
Nitheesh
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
|
neha_rai wrote: i have written this code that splits the number of cars T. to the number of paths R in all possible ways.
Sounds like you need to read up on combinations and permutations.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi all,
I have two applications in VC6.
I have to copy only a single dialog box (not the entire RC file) from one application
to other.
I know we can copy the RC file , but I dont want the entire RC file.
I want to copy only one dialog box from the one RC file and paste in other RC file.
Please suggest.
Regards,
Sunil Kumar
|
|
|
|
|
Hi,
Open the rc file on a notepad or if u r using VS2005 or greater right click on the rc file -> View Code
copy the Dialog declaration's and paste it into your rc file.
thanks
Nitheesh
Jose Jo Martin
http://www.simpletools.co.in
|
|
|
|
|
So I've taken it apon myself to finally get a better grasp on C++. I've had experience in C#, VB.Net and Java and decided, on my own time, to finish the jump into C++.
I've read a book entitled C++, How to program by Deitel, and it is by far way better then the C++ Primer Plus I went through and entirely better then the mistake that was "C++ in 21 days" which was a complete waste of time.
I think I have a handle on the basic concepts, syntax and whatever else the book went through and I think I'm ready to tackle a book that deals with C++ and the MFC. Anyone out there who's been at where I am, still a beginner ready to tackle new concepts (as I've been explained, MFC is where I should go) can please recommend a good reference / beginners book on C++/MFC? Any links on the internet? Anything at all to make a good jump?
A book / article that deals with C++/MFC and using Visual Studio as a compiler is a plus, and any help at all would be greatly recommended. Thanks for the read in advance,
Elie.
|
|
|
|
|
Hi Elie,
I'm pleased to see a .NET programmer wanting to learn Visual C++. My MFC book recommendations are here[^]. I'm sure that others here will be able to provide you with more inputs on that.
Additionally, Thinking in C++ is an excellent, two part book by Bruce Eckel and is freely (and legally) available for download on his site. You can download it : here[^] (the link is actually a mirror, because Bruce's site seem to take too long to load). I did notice you saying that you've done the basics, but this book(s) is one of my favourite C++ books and is worth a read, if you haven't read it yet.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I've been reading o lot on the topic of comparisons in the web lately and I can't find anything interesting. The question is how to compare string output to a map where keys are alike defined strings which represent vectors of integers. I guess I'll have to write a template or a class to do it and it isn't an easy task for the beginner. I would be very grateful for any kind of help!
Waldemar
|
|
|
|
|
Not sure if I understand your question correctly.
But there is a map class in the C++ Standard Template Library.
You are probably looking for something like -
typedef std::map<std::string, std::vector<int>> StringIntVectorMap;
So you can create objects of this type -
StringIntVectorMap compare;
Read more about the map class here - map Class[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks Superman
I'll have a look at it!
|
|
|
|
|
Unfortunately, your hint won't work. I've just realized I've reached a stage that could be called 'advanced programming'. If you're interested in this particular case, I can quote the entire code. Just let me know, providing you've got time to look at it. Anyway, thanks a lot!
|
|
|
|
|
COM port CreateFile -> Close Handle Works great, unless the USB device is unplugged, then it can not be reopened without restarted computer
If usb device is ever unplugged, i get a return of a ERROR_FILE_NOT_FOUND from Create handle, and cannot continue unless the computer is restarted
this happens when I am connected to the device and when I am not connected, just if it is unplugged and replugged in
(this works awesome, and can continue to create and close, until the device is unplugged from the computer and plugged back in)
hcomms[hcommcount-1] = CreateFile(com,
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL ,
0);
if ( hcomms[hcommcount-1] == INVALID_HANDLE_VALUE)
{
DWORD error = GetLastError();
return -1;
}
if (!CloseHandle(hcomms[cindx]))
{
errorCode = GetLastError();
}
|
|
|
|
|
Greg Mort wrote: COM port CreateFile -> Close Handle Works great, unless the USB device is unplugged
What kind of USB device? Is this a USB to Serial adaptor? Can we get a little more information?
|
|
|
|
|
its a custom made device, it uses the mchpcdc drivers
|
|
|
|
|
Well Greg,
I would be willing to bet that each time you plug-in the USB device Microsoft Windows is assigning a new COM port.
Best Wishes,
-David Delaune
|
|
|
|
|
hi,
can anyone suggest me how to convert wchar* to byte*...
Thanks,
Rakesh
|
|
|
|