|
It looks like you're able to successfully open the registry key.
Your problem is when you're trying to read the contents of the value "IFPARA_TCPIP".
Nelek wrote: Can someone tell me what am I not understanding?
Basically you haven't understood how to use this function and how to interpret the error returned.
The error returned tells that there is more data to be read, i.e. the size of the buffer you provided was too small to hold the contents of the registry value. The length returned is the complete length that is required to hold the data, i.e. 1252 bytes.
Try this after you've opened the registry key successfully (non CRegKey version):
BYTE* pBuffer = NULL;
lnResult = ::RegQueryValueEx( hWkKey, "IFPARA_TCPIP", 0, NULL, NULL, &iLength );
if( (lnResult == ERROR_SUCCESS) && iLength )
{
DWORD dwType;
pBuffer = new BYTE[iLength];
::RegQueryValueEx( hWkKey, "IFPARA_TCPIP", 0, &dwType, pBuffer, &iLength );
if( dwType == REG_SZ )
{
szValue = pBuffer;
}
delete [] pBuffer;
pBuffer = NULL;
}
Read more about ::RegQueryValueEx() here[^] and a list of possible data types to store in the registry here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Yes, I am able to open and delete keys / subkeys.
I had made a "bypass" to allow not using the QueryValue (testing only the TCP/IP connection with the 1st member), but now I am forced to use it because I have to differenciate between 4 multiple choices. The value are written in a REG_DWORD to know about the option (MPI_S7 = 0x00, TCP/IP_S7 = 0x03, MPI_S5 = 0x06, TCP/IP_S5 = 0x0B). And depending on what is choosen, go through one function or another.
It seems you are right I was not understanding the functions. VS Help is not very understable for me (35% of contents are on English and the rest on german, and I am spanish , even the MSDN on spanish was made with a translator-bot and even sometimes is difficult for me to understand it )
With the example you have provided me (very good explanation thanks) and both links I think I will be able to solve my problem
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Nelek, you have sent sent me a direct email instead of posting to this forum.
Please do not send personal emails unless instructed to do so for a lot of reasons considering you, other readers and the person you're emailing directly.
No apologies needed, you're instantly forgiven the first time.
Now for your questions:
Nelek wrote: Where are REG_QWORD and REG_QWORD_LITTLE_ENDIAN defined? (I find extrange to be able to get some values and other not, Im under VC++ 6.0)
The registry value types are defined in winnt.h. The 64-bit values are defined in later releases of MSDEV than VC6 so you won't find them in your environment.
Nelek wrote: If REG_DWORD and REG_DWORD_LITTLE_ENDIAN have the same value... how is it possible to differenciate them? I have been working with normal and little_endian formats in other parts of the project and it pisses me off :P
A REG_DWORD and a REG_DWORD_LITTLE_ENDIAN are the same and hence declared as the same type since windows is assumed to be running on an Intel-chipset or compatible. "Normal" in this case is little-endian.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I wanted to try out and learn CORBA with an example, so I downloaded a 60 day trial of Borlands Visibroker.
Having installed it I now tried one of the examples (Bank Agent). However I cannot built this, I get the following error:-
C:\Borland\VisiBroker\examples\vbroker\basic\bank_agent>nmake -f makefile.cpp<br />
'nmake' is not recognized as an internal or external command,<br />
operable program or batch file.
With this rial version, support does not seem to be avaliable!
Another question is can I use Visibroker with Visual Studio 2005 for a C++ solution. I have not seen any examples using Visual Studio 2005, do they exist.
I have been going around in circles with the documentation.
Any help please
|
|
|
|
|
Are u already settle this problem? i also got the same error when i type
"nmake -f makefile.cpp".
please tell me...i also use trial of borlands visibroker.
|
|
|
|
|
I now use ACE_TAO Corba and so I have left BORLAND stuff unresolved.
CORBA seems such hard work for what it offers and freeware makes it more difficult.
However ACE+TAO on Windows using Visual Studio 2005 is the best I have seen.
Get it from here http://www.theaceorb.com/downloads/1.5a/index.html
[^]">
|
|
|
|
|
tq so much for ur help..i really appreciate ur help....now, i already download and install ACE+TAO 1.5a on linux...this is the steps I follow to run CORBA using GNU C.
1. create a workspace
mkdir Messenger
cd /ACE_wrappers/Messenger
2. Create IDL file
3. Run IDL Compiler
tao_idl -GI Messenger.idl
4. create Server.cpp and Client.cpp
5.Create Build File (MPC)
i create GettingStart.mpc file
6. Run mwc.pl
mwc.pl -type gnuace
I stucked at 6th step...
when i run this command, the following message come out
"bash:this command not found"
i already install perl 5.6.2..
please help me..
|
|
|
|
|
Hi, I did get the Messenger example working, but never used mwc.
Try and build using gmake.
You can use
gmake realclean #for a clean build
Remember they are so many build files (Windows, Borland, gcc compiler etc. You need to use (I think) GNUmakefile.
The scheme using the IOR file works, but the Naming Service is a bit 'all over the place'
Hope this helps.
|
|
|
|
|
Hi again, i was build using "gmake realclean #for a clean build". it works...
but now, may i know how to run Messenger?
I was used "./MessengerServer"
but the errorvmessage come out, "bash command not found".
I really appreciate your help..thank you
|
|
|
|
|
Open up a term Window and check if the executable program is where you think it is.
They are a Perl script called run_tests.pl to run both Client and Server using an IOR file.
I am not an expert on Unix, but it all should work, Perl is free so check if you have it.
|
|
|
|
|
thanks!
i am not expert on developing network...
my question is how to create IOR file?
u help me a lot..
|
|
|
|
|
You just give the name of the IOR file and it gets created with the data.
e.g.
server -o my_ior_file
client -f my_ior_file
|
|
|
|
|
hello to all,
how to create new ".rc" file which will contain all the information about the resources added in ur project and how to add this ".rc" file in your project?
Thanks and Regards,
A.Kulkarni
|
|
|
|
|
Create a new project. Add something to your resources using the resource editor. Then look or the name of one control (i.e. IDD_MYCONTROL) with the binoculars button where the toolbar. One of the matches will be in MyApp.rc and the other will be in resources.h.
Make a double click in the result of the *.rc, a window will tell you something about opening the resources in the editor, say yes and enjoy taking a look.
You can put as much resources in your resource editor as you want. Afterwards you can check how it is configured and created using this.
Once you know how. Just make it at your own taste with a text editor and put the extension *.rc when saving as.
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
hi all.
I have some problem with I/O stream.
I write console application, that start another process "B".
process "B" write's some information in consle.
I need to read this message and if you can tell how I can set that out stream of process "B" wos input stream for my program.
is there some function or other way to do read this information.
|
|
|
|
|
|
I am writing a dialogue based application that has several button controls on it. I want the user to be able to press several buttons at once via the keyboard and the dialogue to represent the button as being pushed for the duration of the key presses.
My plan was to use OnKeyDown to read the keyboard and determine which button is pressed. I then want to send a message to the dialogue to simulate the button being pressed by the mouse. I was intending using:
SendDlgItemMessage(IDC_BUTTON2, ON_BN_CLICKED,0,0);
to send a message to the dialoge that a button has been pressed, but I am not having much luck.
I am using Visual Studio 2005
Any answers?
Kalvin
|
|
|
|
|
KalvinComer wrote: SendDlgItemMessage(IDC_BUTTON2, ON_BN_CLICKED,0,0);
It is absolutely useless. Any way BN_CLICKED is the message, not ON_BN_CLICKED. And it is sent along with WM_COMMAND. Also this message should be sent to the parent (dialog). So in the OnKeyDown, you have to send this message to your own dialog, instead of the button.
BTW you need a pushing effect on the button?
- NS -
|
|
|
|
|
To be a little clearer:
I have a dialoge that has two buttons (BT1, BT2).
I would like it to be the case that I can:
press 1 on the keybord and BT1 depresses (and calls and associated button1 clicked method). Releasing 1 un depresses BT1.
press 2 on the keybord and BT2 depresses (and calls and associated button2 clicked method). Releasing 2 un depresses BT2.
Press and hold 1 and 2 on the keyboard, and both BT1 and BT2 depress. Releasing 1 and 2 un-dpresses BT1 and BT2.
Kalvin
|
|
|
|
|
KalvinComer wrote: Press and hold 1 and 2 on the keyboard, and both BT1 and BT2 depress. Releasing 1 and 2 un-dpresses BT1 and BT2
Hope the following code may suit for you...
BOOL CMyDlg::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN )
{
if( pMsg->wParam == '1' )
{
pMsg->wParam = VK_SPACE;
pMsg->hwnd = m_btn1.m_hWnd;
}
else if( pMsg->wParam == '2' )
{
pMsg->wParam = VK_SPACE;
pMsg->hwnd = m_btn2.m_hWnd;
}
}
else if( pMsg->message == WM_KEYUP )
{
if( pMsg->wParam == '1' )
{
pMsg->wParam = VK_SPACE;
pMsg->hwnd = m_btn1.m_hWnd;
}
else if( pMsg->wParam == '2' )
{
pMsg->wParam = VK_SPACE;
pMsg->hwnd = m_btn2.m_hWnd;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
- NS -
|
|
|
|
|
KalvinComer wrote: I have a dialoge that has two buttons (BT1, BT2).
I would like it to be the case that I can:
press 1 on the keybord and BT1 depresses (and calls and associated button1 clicked method). Releasing 1 un depresses BT1.
press 2 on the keybord and BT2 depresses (and calls and associated button2 clicked method). Releasing 2 un depresses BT2.
Press and hold 1 and 2 on the keyboard, and both BT1 and BT2 depress. Releasing 1 and 2 un-dpresses BT1 and BT2.
I would use "pushbutton like" checkboxes instead of normal buttons, because you can make them look depressed just by set their state to checked, and release them by seting their state to unchecked. This would also make the dialog useable for someone who doesn't want to use the keyboard. Your idea of handling two keys pressed at once would work, but I think it would be easier to just assign '1' and '2' as shortcut keys to the respective buttons. That way, a user could press, but not hold '1' to either press or release button 1, and similarly for button 2.
Nathan
|
|
|
|
|
NS17:
Thank you, your code snippet has helped me alot. The key bit I was missing was: generation of my own button down command i.e.:
pMsg->wParam = VK_SPACE;
pMsg->hwnd = m_btn1.m_hWnd;
However, can't seem to get two buttons down at the same time.
Nathan:
Thanks for your suggestion. I now have two pushlike buttons on the dialogue and it behaves just how I want it with respect to the keyboard. But with respect to the mouse can I get the control to be true whilest the mouse is over it and the LH mouse button is down, and it returns to false when the mouse LH button is released.
I'm convinced some combination of your two solutions will get me there but after several hours work, I have got no further.
Having this dicussion has clarified my thoughts: what I need is:
A control either button or push like check box, that the rest of my app can reconise as being true or not, the control must be true only whilest the key assigned to it is pressed or the mouse button is being held down over it. If two buttons are pressed via the keyboard then both control states should be true for the duration of the press.
As some back ground: I am trying to write a simulation of a piece of hardware which has several keys. The state of which are sent regularly out over the serial port, have coded all that bit. The hardware buttons are momentary push buttons i.e. there state is high only whilst they are pressed down. So in real life the user could press more than one.
I can get the behaviour I want from the keyboard thanks to Nathan's idea, that only leaves how the control should behave in response to the mouse. Here I'd like the control to be on only when the mouse is over the control and on getting a WM_LBUTTONDOWN and the control to go off when getting the next WM_LBUTTONUP.
Any further ideas?
Kalvin
|
|
|
|
|
KalvinComer wrote: Nathan:
Thanks for your suggestion. I now have two pushlike buttons on the dialogue and it behaves just how I want it with respect to the keyboard. But with respect to the mouse can I get the control to be true whilest the mouse is over it and the LH mouse button is down, and it returns to false when the mouse LH button is released.
That makes things more complicated. When a mouse button is pressed over a control, the control captures the mouse input so that other windows don't get mouse messages. If you made a subclass of CButton that informed its parent whenever it got a mouse message, and used it for control members, you could update the state of the buttons according to the mouse state as well as the keyboard state.
I've just realized that you could also intercept mouse messages in PretranslateMessage for the same effect.
Nathan
|
|
|
|
|
Nathan,
I have written an ActiveX control to provide the functionality I require, a bit of a learning curve but it's now doing just what I want.
Thanks for your help.
Kalvin
|
|
|
|
|
Hi,
I have notice that, when I open the configurations tool of the 3rd party dll that I am using, if I move the window of the configurations tool, my programm is not able to refresh while the Modal DialogBox is opened. That causes that my programm (in background) acumulates vestiges of the movement of the foreground window. I have checked it out with another programs in background but it doesn't make it.
What should I look for in order to avoid that my program acumulates the tracks of the DialogBox's movement while it is opened? Any tip?
-- modified at 8:50 Friday 5th October, 2007
I hope you can understand what I try to say
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|