|
I think believe MFC makes creating User Interface easier, and along with a bunch of very useful classes, it is easier to write Win32 programs. But these programs depend on the MFC runtime libraries, only if MFC is dynamically linked to it.
I think your problem is because you are running the debug version without the necessary DLL's. If it is a debug version, then make it Release version. It is very likely that the MFC runtime dlls are already present on the target system.
Otherwise, there is no reason that an MFC program will not execute while a Plain Win32 will.
this is this.
|
|
|
|
|
MFC classes are simple wrappers for Win32 methods...
what is the actual error you're encountering ??
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
-- modified at 6:36 Tuesday 31st January, 2006
|
|
|
|
|
Hi ,
I have created a button in a class derived from CWnd.
After the event handler for the button is executed ,the focus does not return to the button.
I can see this default behaviour when the class is derived from CFormView or CDialog.
Can anyone tell me what the problem is?
Thanks,
Gayathri
|
|
|
|
|
can you post the code inside the handler of that button?
|
|
|
|
|
Hello!
I have some char array of hexadecimal values I get from the network. I want to convert them to some printable form. For example I did it like:
<br />
string print_buff;<br />
<br />
char buffer2[100] = {0x7f, 0x80, 0x1a};<br />
<br />
for(int i = 0; i < 3; i++){<br />
char a[3] = {0};<br />
sprintf(a, "%2.0x", buffer2[i]);<br />
print_buff.append(a, 2);<br />
}<br />
This works well to the values 0x7f (127), but for the numbers bigger than 0x7f it doesn't work properly anymore. If I look at 'a[3]' character array (in debuger) I can see that 0x80 has converted to "ffffff80" string. How is this even possible when I limited string with formating option to 2? When I append characters afterwards, "ff" is appended not "80".
Rostfrei
|
|
|
|
|
Rostfrei wrote: char a[3] = {0};
You have to increase the size of the array(may be something like a[10], this will be much safer).
Jesus Lives Forever - Amen <marquee direction="up" height="40" scrolldelay="10" step=".5" scrollamount="1" style="background:#99ccff;border-bottom:thin solid 1px #6699cc">
--Owner drawn
--An eye for an eye makes the whole world blind.
--Jesus is Lord
|
|
|
|
|
I tried that already, but it doesn't work.
Rostfrei
|
|
|
|
|
|
Yes and it should be
7f 80 1a
Rostfrei
|
|
|
|
|
Rostfrei wrote: char buffer2[100] = {0x7f, 0x80, 0x1a};
Here is the problem.
Make that unsigned char buffer2[100];
Jesus Lives Forever - Amen <marquee direction="up" height="40" scrolldelay="10" step=".5" scrollamount="1" style="background:#99ccff;border-bottom:thin solid 1px #6699cc">
--Owner drawn
--An eye for an eye makes the whole world blind.
--Jesus is Lord
|
|
|
|
|
Yes! It works now!
Thank you!
Rostfrei
|
|
|
|
|
In my oppinion there is way too much printf ing in C++ code. Why not something like this?
<br />
#include <sstream><br />
#include <iomanip><br />
<br />
string print_buff;<br />
BYTE buffer2[100] = {0x7f, 0x80, 0x1a};<br />
<br />
for(int i = 0; i < 3; i++)<br />
{<br />
ostringstream ss;<br />
ss << setw(2) << setfill('0') << hex << buffer2[i];<br />
print_buff += ss.str();<br />
}<br />
Steve
|
|
|
|
|
|
Hello!
By looking at the code I know it should work, but it just doesn't and I don't know why. I have an array of hexadecimal numbers (char)
00 1C 61 1A 80 02 07 80 A1 08 06 06 2B 0C 00 81 34 01 A2 03 02 01 00 A3 05 A1 03 02 01 01
when I try to convert it to string the result in print_buff is only "0".
Rostfrei
|
|
|
|
|
In most C++ compilers, char is a signed data type. This means that values greater than or equal to 0x80 interpret the high bit as a sign bit. You are using an integer format %2.0x , so it extends the sign bit.
Try this:
string print_buff;
<br>
char buffer2[100] = {0x7f, 0x80, 0x1a};
<br>
for(int i = 0; i < 3; i++){
char a[3] = {0};
sprintf(a, "%02x", (unsigned)buffer2[i]);
print_buff.append(a, 2);
} The (unsigned) cast converts the character to an unsigned int . I also changed the format slightly.
Software Zen: delete this;
|
|
|
|
|
Could you please help me in my college project work, with sample code..
1) 5 students to input on one program (5 items per record, where 2 are key items)
2) should have a small menu (input, change, delete, report & exit)
3) codes to store input data in a single file at server
4) simultaneously access server to retrieve data on key items
project can be : student marks, books library, cinema name/artists, or any thing you feel comfortable
wrongly i put this in c++/CLI & didn't get reply, the mistake is mine.
Best Regards,
Bobby
|
|
|
|
|
|
I'm afraid your mistake is this: The CP forums are here to help you with an existing program, not to write it for you. Try writing the code yourself, and then come back when you've got a question.
Good luck.
Software Zen: delete this;
|
|
|
|
|
I recently had a bit of an issue where I was looking for a string tokenizer component. I posted on c.l.c.m, and was informed that STLSoft had one called "string_tokeniser" (note spelling). This both amused me and irritated me cos I use STLSoft and had done a search (for "tokenizer") and found nothing.
My experience of STLSoft over the last 2-3 years is that the code's great but the docs suck. So I posted on their newsgroup, complaining about the yawning gap between the quality of the code and the docs, and also asked why the author(s) doesn't post to Code Project.
It was good that I got a swift reply, but like a bad lawyer who doesn't know the answer to the question (s)he's asked, I got snapped on my own challenge, as Matt Wilson from STLSoft asked if I would consider posting to CP. So, I've created a new account - forgot my old details :$ - and will have a go at putting my size 12 where mt mouth is.
So, I was wondering whether anyone in CP already used STLSoft (http://stlsoft.org/[^]), and whether they'd had any experiences - good or bad - that might tallie with mine, as a good place to start.
Fanks
Danny T
-- Ain't no monolithic framework yet worth the hassles --
|
|
|
|
|
hi
i got how to create and run service, but i dont know how to make a service to a specific user. I have passed the last two parameters in the createservice function (username,password) even though i can't do it.
i.e we can't modify if we have logged from another user. please help me in this problem.
sudheer
|
|
|
|
|
lately i been tinkering around with dll files trying to learn more about them and developed a small app that loaded the functions i use a lot across most applications i make from a dll file. the application in a sense works but the main issue i am having is parts of the program do not load as they should, and load at wrong times, maybe a screen or 2 after it should have been displayed. is there something i could do to prevent this from happening or maybe fix the problem?
|
|
|
|
|
swatgodjr wrote: parts of the program do not load as they should, and load at wrong times, maybe a screen or 2 after it should have been displayed
That is not clear. Do you mean the dll does not load when it should? Does it load late? Sorry it does not seem clear. Please give more details.
Even though I may not be able to help you someone will.
this is this.
|
|
|
|
|
well i fixed part of it, see i made my own functions to format menus in a console app, it would display all but the last line and i think for that, the problem was because when that line gets displayed i have the program ask the user for input.
but i also have the same issue some place else, i made it so if incorrect input is detected, it would load a custom error function out of the dll file and display a formated error message. if the functions are inside the program it works fine but when loaded from a dll to be used inside the exe it causes this problem.
and about my question, the dll file loads like it should but some how lines of text will not appear from soem of the functions where they are supposed to.
|
|
|
|
|
Sorry, I have never tried what you are doing. It sounds like the dll-function is displaying the error instead of the main program. You can make the dll function so that it only returns the error text message, instead of displaying it also. Take the string from it, and display it in the main program.
And are you using cout ? If you are, then you know cout buffers a lot of output, so the displayed output can get messy. Try using something like cprintf . I think that should do it. If it doesn't then try the above ideas. If that doesn't help either, then create a new thread, and try posting some code with it as well, hopefully someone will help you.
this is this.
|
|
|
|
|
thank you, that worked exactly as i was wanting it to
|
|
|
|