|
how to check if a PC is connecing to the internet programmaticaly by VC application?
includeh10
|
|
|
|
|
How about this?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
none of them works.
my VC6 doesn't have the "best function" IsNetworkAlive().
includeh10
|
|
|
|
|
|
Hi everyone,
I have a need where I have to move a button programatically.
I am trying to use the SendMessage(handleOfButton, WM_MOVE, 50, 50) function, but it does not seem to work. I have a feeling it only works on top level windows or dialogs. Is there a way to move a button programatically. What message should I use?
Cheers,
-K
-- modified at 15:19 Wednesday 26th October, 2005
|
|
|
|
|
Keith Vitali wrote: I am trying to use the SendMessage(handleOfButton, WM_MOVE, 50, 50) function, but it does not seem to work.
Probably because it's a message that the framework sends after a window has been moved. Try MoveWindow() or SetWindowPos() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Hi,
Is it possible in anyway to load a file into memory and then run it
from there? I am working on a file compressor
(www.nemokprod.go.ro/nb.htm) that can compress and encrypt and save
multiple files as an exe file that can then run the compressed files
after unpacking them to a temp folder. The problem is that I have to
unpack the files to the hard-disk and then run them from there, making
them vulnerable to user that may try to get the original (unprotected)
files.
So the user shouldn't have access to the file operations in the
background. So I need to keep the original unpacked files hidden from
the user, until after they are opened by the unpacker and then deleted.
So users should have no kind of access to the files (should not see
them, open them, should not be able to modify or copy them) but the
unpacker should be able to run them. (that is why I think that the
memory is the best solution)
So is there any way to protect them, like unpacking them directly to
memory and then run them from there? Something like a virtual disk in
memory?
Thanks.
Nemok
|
|
|
|
|
This has been asked many times before but an answer is still 'unknown.' If you unpacked the files to disk, could you not use an obscure name like a GUID rather than something like mysecretfile.exe?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes but using a FileMonitor like the one from SysInternals it is very easy to find out what files is the app working with.
Nemok
|
|
|
|
|
True, but if the name were not obvious, would the person know what to do with it even if they managed to make a copy of it?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Yes but I need some more fail proof than that.
Nemok
|
|
|
|
|
a little Googling is enough to convince me that it is not a simple task.
you might take a look at UPX (available from sourceforge). i think it can do this.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Hi,
It is possible to load a binary, executable block of raw data into memory and link a function to it. So you could call that 'extra' function from your code without any problem. Maybe this is what you need ??
But to load an entire file into memory and to run it that is something different.
codito ergo sum
|
|
|
|
|
Actually yes I need to load an entire file and run it. Any ideas?
Nemok
|
|
|
|
|
Are you looking to just load dlls, or run the actual exe from memory? I've been working on virtual files system similar to thinstall, but am far from finishing. However, I do have some code that will load a dll from memory with certain limitations. Just depends on what you exact needs are.
--
Joel Lucsy
|
|
|
|
|
Hello,
I've encountered a strange problem when I use the const_cast() operator. See the following code that behaves strange:
std::stringstream sstrMsg;
char* pszMsg = const_cast<char*>(sstrMsg.str().c_str());
SPrintBuffer(&pszMsg);
I've checked the return values of both stringstream::str() and std::string::c_str() . They both return the expected data. Strangely enough, after the cast, pszMsg points to some undefined memory address. (The address pointed to holds the value -18).
I'm currently using the following workaround:
char* pszMsg = new char[sstrMsg.str().length()];
strncpy(pszMsg, sstrMsg.str().c_str(), sstrMsg.str().length());
SPrintBuffer(&pszMsg);
delete[] pszMsg;
Does anybody have a clue why const_cast is producing undesired results?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi,
If you mean the const_cast casting operator, I believe you have used it wrong. It should be used like this:
char* pszMsg = const_cast<char*>(sstrMsg.str().c_str());
This shouldn't give any problems.
codito ergo sum
|
|
|
|
|
Hello,
I used it just like you said it should be used. It's just that the '<' and the '>' 'disappeared' because I didn't use '<' and '>' respectively. Sometimes the parser for the message removes those in pre tags and sometimes it doesn't.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Your code looks very dangerous.
Q1) Why would you need to cast away the constancy of the pointer returned by c_str() ?
How about using: const char* pszMsg = sstrMsg.str().c_str();
Q2) Why would a function named SPrintBuffer() need a pointer to a pointer of type char* ?
The name implies that it is just going to print out the contents of the buffer, not modify it.
Note: Modifing the data return via c_str() , is a very bad idea.
INTP
Every thing is relative...
|
|
|
|
|
I know that the code looks very dangerous. I double checked the code for SPrintBuffer() and it doesn't modify the string.
The reason that the reason the function takes just a char* and not a const char* is unknown to me. I need to add a link layer of a protocol to a program that my teacher wrote. Please don't tell me, the entire program is badly designed and all the code looks like spaghetti... If you want to see some obfuscated C code, this program is right for you!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Sorry I have been gone for a few days.
1) It sounds like your teachers code would not pass a review by me, let alone a quality assurance team.
If the function does not modify the data pointed to by the argument, then you should say so by making it a pointer to constant data.
2) You still should not need to use const_cast , instead you can just call the function like so: SPrintBuffer((char*)str.c_str()); .
Note: The const_cast should not be needed in this particular case.
Note: In your original code you are trying to pass a char** and not a char*
|
|
|
|
|
John R. Shaw wrote: Sorry I have been gone for a few days.
So have I...
John R. Shaw wrote: 1) It sounds like your teachers code would not pass a review by me, let alone a quality assurance team.
That was my first thought and I offered to rewrite the entire program instead of doing all the other assignments. This was a no-go since the course is not going to be given anymore.
Anyway, that's the way we learn things in college these days..
John R. Shaw wrote: 2) You still should not need to use const_cast, instead you can just call the function like so: SPrintBuffer((char*)str.c_str());.
I force myself to use straight C++ only. The C-Style casts are there fore backwards compatibility. They shouldn't make a difference. I'll try it and let you know if there it will work.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Looking for GUI simple tutorial with VC++ .NET version 7.1
I am a newbie in this product. I would like to have a GUI simple tutorial for VC++ version 7 using with MFC (such as click on button then get result of addition of 2 numbers or display a note on edit box. I downloaded 1 sample from www.msoe.edu/eecs, but it for older version then I was stuck in the middle instruction (due to ClassWizard could not be found). I found microsoft VC++ devepment tool is very very hard to learn.
Please advise me a good book about MFC and GUI for beginner.
I am a hardware guy, so I like GUI to interface with devices and instrument.
Thanks.
MilkyWay
MilkyWay
|
|
|
|
|
Loc Milkyway wrote: I found microsoft VC++ devepment tool is very very hard to learn.
Well, C++ is a difficult language and Visual C++ is an intimidating environment! Other languages, such as VB and C# are far easier for doing GUIs.
Anyway, I took a peek at this site and it looks quite good.
http://www.functionx.com/visualc/[^]
If you click on the "Introduction to Applications" link in the top left it takes you into a tutorial in which they occasionally tell you how to do it if you're using VC++ 6 and how to do it in VC++ 7.1. You will also see VC++ 7.1 IDE screenshots in various places.
Instead of ClassWizard you have to use the Class View and Poperties windows. See here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcgrfWhereIsClassWizardInVisualCNET.asp[^]
Kevin
|
|
|
|
|
Kevin ! Thank you... thank you very much. www.functionx.com is the cool site for me.
MilkyWay
|
|
|
|