• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

May I be a C++ leech?

jonnyGURU

Moderator <BR> Power Supplies
Moderator
I'm not too good w/ C++. I know enough to be dangerous. 😱

Anyhoo... I made a C++ app a while back that would install VNC client on a workstation, launch it, and connect back to one of our servers.

Real simple and prettied up w/ company logo, etc.

So now they want me to write something that checks to see if port 5901 is even open on the server before it attempts to launch VNC.

I figured it was no problem... C++ comes with MFC Winsock classes. I break out C++ in 21 days and on day 20 there's an app that... once I can get it working... will help me understand how to implement the function into my own app.

I get to a function that allows the value of a button to toggle between "Connect" and "Listen" depending on whether or not you're client or server, and the button doesn't change. It says "Connect" until you click on the Server radio button and then it switches to "Listen" and it doesn't switch back.

The book makes this as clear as mud and I'm compiling w/o errors.

Anyone here able to help if I zip up my workspace and upload it? I know it's a lot to ask, but I need to show SOME productivity beyond a dialog box with buttons that don't do anything. 😀

TIA!
 
So if you run the app twice and tell one to listen and then the other to connect, then what happens?
 
I haven't even gotten that far. I just want the app to function the way it was designed before I get to far into it. It will probably work properly because the code that changes the button text is just a simple if then SetWindowText.....

If I move to far forward and have it function, even if it functions correctly, I'm going to have so much code it's going to be harder to troubleshoot later. 🙁
 
Originally posted by: fs5
my suggestion, move to C# and .NET

C#? Yeah.. I probably should sooner or later.

,NET? I have .NET and I hated it. Microsoft broke everything that was fixed in Visual 6. They moved things around that simply DID NOT need to be moved around. 🙁

Just like Windows 2000 to XP! 😀
 
Originally posted by: Wizkid
http://www.codeproject.com/internet/tcpscan.asp

Have a look at that... you can probably just hack something together with that 🙂

Hmm... Looks promising.

DOH! Need to create an account to download the source. Oh well! Looks like I'm signing up with yet another website.

You know... with all of the sites I have become a member of to either help or be helped, one would almost think jonnyGURU was omnipotent! 😛
 
Originally posted by: jonnyGURU
Originally posted by: fs5
my suggestion, move to C# and .NET

C#? Yeah.. I probably should sooner or later.

,NET? I have .NET and I hated it. Microsoft broke everything that was fixed in Visual 6. They moved things around that simply DID NOT need to be moved around. 🙁

Just like Windows 2000 to XP! 😀

I've been doing .NET last few years, and now just for a project been doing some VB6 in Visual 6, and GOD you can't compare the two. Studio .NET/.NET is exponentially better in overall feel.
 
Originally posted by: darkamulets
You would think we had a programming or software forum.

You would think.

Originally posted by: rsd
Originally posted by: jonnyGURU
Originally posted by: fs5
my suggestion, move to C# and .NET

C#? Yeah.. I probably should sooner or later.

,NET? I have .NET and I hated it. Microsoft broke everything that was fixed in Visual 6. They moved things around that simply DID NOT need to be moved around. 🙁

Just like Windows 2000 to XP! 😀

I've been doing .NET last few years, and now just for a project been doing some VB6 in Visual 6, and GOD you can't compare the two. Studio .NET/.NET is exponentially better in overall feel.

I guess it's just what you're used to. Like the whole IE versus Mozilla thing. I've been using Mozilla since Netscape 2.0. There WAS NO Internet Explorer in Windows 3.11. For the last six months I've been using IE because I'm using XP64, Firefox64 is still a bit buggy and I want to wait until a stable version came out. I FEEL LIKE CLAWING MY EYES OUT with how horrible IE is... and I've been using it for six months straight and I STILL can't get used to it. Yet some people here swear by it, feel Mozilla is over-hyped and even hack their Firefox so it works somewhat like IE. Whatever! 😀

 
NIIIIIIIIIIIIIIIIIIIIIIK....Where are you ?
<==tries again
NIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIK.....! 😀
NIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIK.....!
NIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIK.....!
NIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIK.....!
NIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIK..... ! 😀


What have you done to NIK ... :frown:

Regards

ng
 
sorry, i realized that i never reinstalled visual studio after i cleared off my laptop this last time around. can you tell me if the server radio button toggles on and the client radio button toggles off when you click on the server radio button? it's been a while, but it looks weird to me that the resource file does not include the server radio button in a GROUP. if the client radio button is not toggling off when you click on the server radio button, that would explain why m_iType is not being modified in your OnRType function.
 
It does. The radio buttons belong to IDC_STATICTYPE and each of the two radio buttons do respond to the other.
 
when you run this through the debugger, does the value of m_iType change when you click on each radio button?

edit:
i may not be of much help until i find a machine here with visual studio on it. things look right -- the DoDataExchange function is supposed to modify m_iType as the client radio button is toggled on and off, and your OnRType function checks that value to determine what text to set.

if you don't find m_iType changing and want to try a different way, you can always call IsDlgButtonChecked to see if the client radio button is checked.
 
hm. can you at least throw in an AfxMessageBox to print out the contents of m_iType? also, have you tried using IsDlgButtonChecked? i'm not sure what you mean when you say you can't make out the debugger.
 
just as a hint to finding the problem in your code (in general, not just for this particular problem) -- make sure you have a working debugger. failing that, make sure you have some way of knowing what code is reached, and the values of variables, even if you need to just write to a file, a console window, or bring up a dialog box.
 
Will take a stab at it this week-end.

Look for a PM by Mon morning with comments.
 
Originally posted by: jonnyGURU
You know... with all of the sites I have become a member of to either help or be helped, one would almost think jonnyGURU was omnipotent! 😛
Omnipresent. If you sign up for help sometimes you're definitely not omnipotent. 😉

 
Originally posted by: Perknose
Originally posted by: jonnyGURU
You know... with all of the sites I have become a member of to either help or be helped, one would almost think jonnyGURU was omnipotent! 😛
Omnipresent. If you sign up for help sometimes you're definitely not omnipotent. 😉


LOL! True. I'm not everywhere at once, but I am everywhere. 😉

I haven't had a chance to fire up Visual since I got home.

What I meant when I said, "I couldn't find it in the debugger" is; I don't know what to look for. I don't know how to get the debugger to show me the value of variables. I had a variable tab, but the m_iType was nowhere to be found in there.

 
Someone PM'd me. I'll post it here, but I won't say who it was because for some reason they didn't want to post what they said in the thread:

For the Server radio button, you call a handler named OnRType.
For the Client radio button, you call a handler named OnRclient which does nothing.

You also have a dummy handler named OnRserver which also has no code in it.

Correct. But that's the way the book (got to love us noobs) has it. Later, naturally, the OnRclient and OnRServer are going to dictate whether you're sending or receiving packets, but right now I'm just wanting the button to change the way the book says it should.

I think there's just something missing from the book, because it would seem to me... as the PM is implying... that OnRServer and OnRClient would AT LEAST set a variable so the OnRType would know what bullet is checked! But it's not there!

I think that's what I'm looking for... whatever is missing. I've tried defining the variable within those handlers, but that didn't work. 🙁 I just don't know enough to get this working.

I'm going to move forward with the rest of the script. Maybe there'll be something later on that goes into the OnRServer and OnRClient events that will make sense and help me get the button to work.

Thanks all!
 
Back
Top