|
Does anyone have any samples for talking to USB port without having to write a full device driver. Conversely is there a third party general purpose NDIS USB driver around, that would enable TCP/IP over USB link.
Happy programming!!
|
|
|
|
|
Ok so I finnally learned how to send text messages ovet the internet to my own instant msgr. But that was easy enough.. but now how do I send a command??? For example, how would I send the command to open a cd-Rom drawer? For example I would use the code "mciSendString("Set cdaudio door open wait",NULL,0,NULL);" to open the cd drawer, and I would use the code "ExitWindowsEx(EWX_POWEROFF | EWX_FORCE, 0) ;" to exit windows, but how could I send them using my mesenger program???
|
|
|
|
|
You messenger on the client side (I hope you have some kind of app that getting your messages you're sending by your messenger) should acts this way - if it get some string - if it's just a normal (non-command string) - e.g. "Hi pal !" it ignore this string, if it's a command string (you should define the set of "command" strings by yourself) let's say "ExitWindowsEx" the clients side proggie (that got this message) should call ExitWIndowsEx API function ... The same for "mciSendString" and any other command you'd like to have in your "Messenger".
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor@soukhov.com | ICQ:57404554 | http://soukhov.com
|
|
|
|
|
I have a dialog based app. In the dialog editor I added the maximize/minimize box. I want the dialog box to START maximized. How can I do this?
Thx
Adam
cabadam@houston.rr.com
|
|
|
|
|
Handle WM_INITDLG (OnInitDialog). In the handler do this:
PostMessage (WM_SYSCOMMAND, SC_MAXIMIZE);
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks!
Adam
cabadam@houston.rr.com
|
|
|
|
|
I have a SDI application. My view is split into 2 parts. One of these windows is a List View. The user has the possibility of adding an item in the list view from a dialog.
My problem is that I don't know how to get the information of the list view to call the function which to add items.
I tried the code below but it doesn't seem to work.
CMainFrame *pMainFrame=(CMainFrame*)AfxGetMainWnd();
CDocument * pDoc = ((CView *)pMainFrame->m_wndSplitter.GetPane(0,0))->GetDocument();
CBOFListView* prt = (CBOFListView*)pDoc->GetRuntimeClass();
prt->AddItemToList(Item); //AddItemToList is the function used to add items
Thanks
Regards!!
|
|
|
|
|
Try moving the creation of the dialog into a handler in the list view class. Then all you can just pass a pointer to the view to the dialog in the dialog's ctor.
CYourDialog wndYourDialog ( this );
Where your dialog's ctor looks something like this;
CYourDialog::CYourDialog ( CYourView * pView ) : m_pTheView ( pView ) {}
Then just add the items to the view from the dialog throught the pointer to the view.
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
i'm sure it's quite easy, but i'm a beginner, so if someone could help me: how can i read a cd toc under windows98 with win32 functions(or anyhow).
thx in advance
d4n
|
|
|
|
|
Hi. When I'm trying to AddItem to ListBox which is in the Modal Dialog, I get
a Run-Time Error.
I'm really stuck, because it works allright with Modelles dialog.
Thanx in advance
|
|
|
|
|
First) How you construct your ListBox.? In what event?
Second)Please write part of the code....
Carlos Antollini.
|
|
|
|
|
|
Hello, the codegurus around the world.
You should understand the diff bet Model and Modeless Dialog.
Modeless dialog never stops the main process, but Model Dialog
stops the main process like the message box.
So, this means that you must add the item to ListBox on Model dialog
by OnInitDialog, or you can use timer or thread code in Model dialog to add the item to ListBox outside of OnInitDialog when you want to add the item
to ListBox from the control outside this model dialog.
Or you can create the model dialog by the different process, and get CWnd
of this ListBox, you can add the item to ListBox from any application.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
I have rarely used any STL in my 2 years of c++, but I wanted to learn a bit more about it, so I started by reading the one chapter in Deitel and Deitel on it. But my first example from that book generated a bizare error in MSVC. Does MSVC support STL properly and do I need to do something especial? Or is
my book too old and the STL standards changed too much since this book was written in 1997.
Here is the code:
#include <iostream.h>
#include <iterator>
using namespace std;
int main()
{
cout << "Enter two integers.";
istream_iterator< int > inputInt( cin );
int number1, number2;
number1 = *inputInt; //read first int from standard input
++inputInt; //move iterator to next input value
number2 = *inputInt; //read next int from standard input
cout << "The sum is : ";
ostream_iterator <int> outputInt(cout);
*outputInt = number1 + number2;
cout << endl;
return 0;
}
And here are the 2 errors:
Compiling...
main.cpp
c:\C++\STL\Fig205\main.cpp(14) : error C2664: '__thiscall std::istream_iterator<int,char,struct std::char_traits<char=""> >::std::istream_iterator<int,char,struct std::char_traits<char=""> >(class std::basic_istream<char,struct std::char_traits<char=""> > &)
' : cannot convert parameter 1 from 'class istream_withassign' to 'class std::basic_istream<char,struct std::char_traits<char=""> > &'
A reference that is not to 'const' cannot be bound to a non-lvalue
c:\C++\STL\Fig205\main.cpp(23) : error C2664: '__thiscall std::ostream_iterator<int,char,struct std::char_traits<char=""> >::std::ostream_iterator<int,char,struct std::char_traits<char=""> >(class std::basic_ostream<char,struct std::char_traits<char=""> > &,
const char *)' : cannot convert parameter 1 from 'class ostream_withassign' to 'class std::basic_ostream<char,struct std::char_traits<char=""> > &'
A reference that is not to 'const' cannot be bound to a non-lvalue
Error executing cl.exe.
Fig205.exe - 2 error(s), 0 warning(s)
|
|
|
|
|
This code was compiled with no errors with VC++6(SP5)
#include [stdafx.h]
#include [iostream]
#include [iterator]
using namespace std;
int main()
{
cout [[ "Enter two integers.";
istream_iterator[ int ] inputInt( cin );
int number1, number2;
number1 = *inputInt; //read first int from standard input
++inputInt; //move iterator to next input value
number2 = *inputInt; //read next int from standard input
cout [[ "The sum is : ";
ostream_iterator[ int ] outputInt(cout);
*outputInt = number1 + number2;
cout [[ endl;
return 0;
}
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor@soukhov.com | ICQ:57404554 | http://soukhov.com
|
|
|
|
|
Hey guys
I want to use a file to store settings for my program preferably an ini file. Are there and API function that control writing and reading to and from ini files so all i have to do is put the data in rather then having to worry about the layout.
Cheers
Peter
|
|
|
|
|
See CWinApp::G/SetProfile...() and G/SetPrivateProfile...().
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
WritePrivateProfileString() and GetPrivateProfileString() does what you want.
Why don't you use the registry instead?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
And don't forget the GetPrivateProfileInt() and WritePrivateProfileInt() functions.
Carlos Antollini.
|
|
|
|
|
The functions mentioned previously are provided by Windows for backwards compatibility. You should use the registry unless you have compelling reasons not to, such as a huge amount of data to store and you don't want to bloat the registry (like it needs your help), or you want users to access and modify the file.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
One simple Question:
I have a HWND from a window found by EnumChildWindows.
It is an edit-control.
How can I get the text of this window?
GetWindowText does not seem to work, the MSDN says as follows:
If the target window is owned by the current process, GetWindowText causes a WM_GETTEXT message to be sent to the specified window or control.If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string.
i.e., since the edit-control I have found belongs to a different thread, the returned window-text is always null.
How can I get the text?
SetWindowText also doesn't work, because the Window belongs to a different thread.
any suggestions?
thanks
|
|
|
|
|
Maybe the hilighted text from MSDN refers to non-child windows, that can have a caption. An editbox doesn't, and since sending a WM_GETTEXT can't work for another process, the function fails and returns zero.
Just supposing though, I'm not sure
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
I was just working on a program that needs to do what you are asking. The problem here, is that you do not know how much text is in the control in order to read it. To exaserbate the problem further, you cannot get a pointer to the buffer that holds the text, because different controls keep the text in different places.
The solution is to send a pair of messages to the window you want to extract text from. The first queries the window for the size of the text it contains, and the second retrieves the text. Some sample code:
int len = ::SendMessage( hWnd, WM_GETTEXTLENGTH, 0, 0 ) + 1;
TCHAR* text = new TCHAR[len];
::SendMessage( hWnd, WM_GETTEXT, len, LPARAM( text ) );
delete[] text;
Adding one(1) to the length is important, because the WM_GETTEXTLENGTH message does not include the terminating null character in the length. Using the TCHAR type will allow your code to compile on both ANSI and Unicode environments.
One caveat: You cannot extract the text of a password-protected edit field on Win2k and WinXP. Microsoft finally plugged that little security problem
--
Paul
"I drank... WHAT?"
|
|
|
|
|
Hello, I'm really new to C++ and windows programming trying to teach it to myself. so I picked a simple and silly project, I'm trying to write my own keyboard drivers for the special shortcut keys on my keyboard. I only say driver for lack of a better word, as I really have no intention of using DDK, I simply want to use a windows hook to redierct them but I can't fiquire out how to the OEM scan code out of the lParam of KeyboardProc and the they aren't defined as virtual-keys (I assume because the manufacturer seems to be using a hook as well) any help would be appreciated
Thanks,
ßlack Widow
|
|
|
|
|
I'm working on a program and I need the back ground of my static tect controls to be black and the text to be White. How whould I go about making these changes??
Thanks ~
|
|
|
|