|
Try looking at the ShellExecute() or CreateProcess() API functions.
Software Zen: delete this;
|
|
|
|
|
Hi,
I'm running Visual C++ 6.0 MFC Document/View. I decided to initially have my menu selections begin in a disabled mode (grayed) and then enable them when needed. I used the resource editor to set the properties dialog box check for grayed, but the menu items are not grayed and I can still select them. I have commented out all references to all OnUpdateCommandUI() functions. The AppName.rc file has the menu items I defined to be grayed as grayed. Does anyone know why the menu items keep comming up in an enabled state?
Buck
|
|
|
|
|
If you have handlers ( OnCommand ) for your menu items, them will be enable, this is the default for MFC.
If you want to disable them, put back the handlers for the ON_UPDATE_COMMAND_UI and inside each one, set the value to pCmdUI to a valid value :
void CMainFrame::OnYourHandler( CCmdUI* pCmdUI )
{
pCmdUI->Enable( someBooleanValue );
}
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Thanks,
It is working the way I want it to now.
Buck
|
|
|
|
|
hey this is my first time posting so forgive me for any errors.
well, heres the deal. im building a chat program. the user enters text then hit sends. the max he can enter is 1000. when he hits send, the client uses the send() func to send the msg to the server. it looks sorta like this:
<br />
send(clientSocket, buffer, strlen(buffer), 0);<br />
NOTE: at the end of the msg i added to line breaks(\n\r\n\r);
the server then recieves the message and puts it in a buffer char array with [1000]
<br />
recv(clientSocket, buffer, 1000, 0);<br />
then, for debugging purposes, the server prints out what it received.
also the strlen(buffer) is printed out.
the output for the message "hey" is:
1004 characters (already wrong)
then it prints out "hey", two line breaks, and 1000 weird chars.
my question: how do i isolate just the hey and the four chars that make up the two line breaks???
i just need an idea then i can form somethin..
thanks all!!
The Legend...
|
|
|
|
|
hello all,
i am developing an application for a client where i have only the PST lines to communicate. but the database is there in server which is far a way from my site. i need to dial the data from client application and retreive the data. how do i do that from my client application.
Could any one plz suggest me plz.
Thanking u all.
regards,
Basheer.
|
|
|
|
|
Hi everyone,
I'm working on an application that I'm trying to migrate from using a useless lib that is inspired from MFC to only use MFC, but I do not want to rewrite the whole application as I dont have time for that, atleast not now.
Problem is that this library exposes a WinMain-method and the application has it's own CWinApp-kind-of-class.
Problem is the following, I want to be able to use a proper CWinApp as parent with everything that comes with it, such as messages and windows etc.
Currently, this class is derived from CWinApp aswell as a similar class within the lib.
Only problem is that some messages are not routed as they should.
In this case, we're talking about WM_KEYDOWN.
I've looked in WinMain from this lib, and it traps the WM_KEYDOWN and it calls IsDialogMessage that is supposed to route the message. I've checked the hwnd and compared it with what I found in Spy++, and the window that it's routing this message to is the one I want, I.e. my mainframe, but the message never arrives in the msgloop, nor on a normal ON_xxx nor in PreTranslate within the mainframe.
So, question is:
Is there something I can do to ensure that all messages are routed? I've got a feeling that there's a missing thread or a thread where the object is created but not the actual thread, hence no messagepump.
I know this isnt very clear, so please flame me with details that's missing.
|
|
|
|
|
In the edit box property, I can only set TRUE for Number.
Then I only enter integer number in edit box. How I can set property to accept only decimal number into edit box ? I think I have to filter the user's typing in to edit box ?
Thanks.
MilkyWay
|
|
|
|
|
<br />
int userNumb;<br />
SendMessage(HANDLE_TO_EDIT_BOX, WM_GETTEXT, (WPARAM)10, (LPARAM)userNumb);<br />
if(userNumb<0)<br />
{<br />
}<br />
else<br />
{<br />
}<br />
the (WPARAM)10 is the max chars..(10), and the userNumb would be the input. i dont know if you can assign an int to that location, usually i use char* but since the edit box is set to numbers-only it might work!
the legend...
|
|
|
|
|
Thank you for advice. My purpose is limit the user enters wrong number into edit box.
ex:
when he enters 12.4, it is o.k, but when he enters 12T he will get message error after type "T" .
When I set property Number is TRUE I can only get 12.4, I got beep after typed "."
Any way I go around (hard way) by conversing string text from editbox to floating numb by atof(m_ebMember);
cheers.
MilkyWay
|
|
|
|
|
you'll have to overload the WM_CHAR event with OnChar() handler...
in it, you can filter the characters typed, and allow only the ones you want, such as the 10 digits plus the period ('.')... (also a sign if you like...).
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I use MFC dialog .net 2003
Could you please teach me how to implement this.
Where I overload WM_CHAR, How I call OnChar().
Thanks
MilkyWay
|
|
|
|
|
Loc Milkyway wrote: Where I overload WM_CHAR
exactly the same way you overload the EN_EDIT event...
Loc Milkyway wrote: How I call OnChar().
you don't call it, it is the framework that calls it for you each time a character is typed in the edit box, but before it is displayed...
void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) {
TCHAR c = (TCHAR) nChar;
if(::isdigit(c) || c == '.') {
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
}
here, you'll print only the 10 digits and the '.'
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Here is an article about one way to do this : [^]
|
|
|
|
|
When I use my application statically linked to MFC, this is no problem. Since I'm trying to use localized resources (multiple languages), I need to dynamically link MFC. When I make this one change, the program no longer links. I get the following:
xxxx.obj : error LNK2001: unresolved external symbol "class CProcessLocal<class _AFX_MAIL_STATE> _afxMailState" (?_afxMailState@@3V?$CProcessLocal@V_AFX_MAIL_STATE@@@@A)<br />
Release/xxxx.exe : fatal error LNK1120: 1 unresolved externals<br />
Error executing link.exe.
Is there some way around this? For those who aren't familiar with what this is for - it's the code you often see on the web for sending email from within an application. It uses MAPI to accomplish this (at least that's my understanding).
I've tried many searches but I only get code samples for sending email. Nothing on this linker issue.
Thanks for any help you may be able to provide.
-- modified at 9:44 Friday 18th November, 2005
|
|
|
|
|
I have a small API that consists of about 10-12 C++ classes. It's relatively straightforward C++, little use of templates other than in the public interefaces I use std::string for string types and in the impl I use stl for various collections. Now I'm having to look into migrating this to managed C++ for a client. How hard is this? Is it even worth doing given that there are now two versions of managed C++ (one for VS 2003, and a newer, incompatible one for 2005). Would it make more sense to just rewrite the API using C# (the API isn't enourmous, so this isn't that big of a deal)? The API uses sockets and is multi-threaded (it creates 3 threads to do it's work) if this makes a difference.
I'd very much like to hear from other's what their experience has been with something like this.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Jim, between the older MC++ syntax and C++/CLI, the port would be far easier with C++/CLI. Except you'd need .NET 2 then.
|
|
|
|
|
Yeah, well I suspect I'll have to support both environments, which I really don't want to deal with.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
I'm more interested in why you are "having to look into migrating to MC++ for a client".
What is their reasoning ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
They (the client) say they have several other 3rd party libs they want to use which are all .Net based ( I gather they were written in C#), so they'd like to make use of our API plus these other libs in one .Net based app.
I don't know enough about managed C++ to say one way or the other whether this is worth the effort or not, so I was hoping to get some feedback from others who may have tried something like this.
My gut feeling is that it is NOT worth the effort/hassle/annoyance, and if they really need a .Net lib then we'd be better served by just re-writing our API in C#.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Generalizing from my prior experience with this sort of thing (different languages, but similar situation), it's going to be a lot easier in the long run if you go ahead and port to C# now. Between the hassle of the two forms of managed C++, all of the required conditional compilation between the two, and so on, it sounds like a 'pure' C# solution would be preferable.
Software Zen: delete this;
|
|
|
|
|
Hello
I am using MFC to create a program that reads a file from the floppy. That floppy uses linux file system ext2. Can anyone give some hint to do it. I have understood ext2 system architecture. Can i use CreateFile(...) to get an handle to that file.
Thanks
Waiting for your kind responce...
Aqueel A. Mirza
We Believe in Excellence
|
|
|
|
|
Hello.
You can use CreateFile to get a handle to the volume. Then you can read and write disk sectors directly.
And seek.
All in even multiples of the sector size, of course.
Open it this way (m_drive is 'A' for drive A :
<code>
sprintf(fromFilePathName,"\\\\.\\%c:", m_drive);
hDrive = CreateFile(fromFilePathName, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
dwErr = GetLastError();
if(hDrive != INVALID_HANDLE_VALUE && dwErr == NO_ERROR) {
// OK, go!
</code>
|
|
|
|
|
Does VC6 support C99 standard? if so how to enable it?
|
|
|
|
|
C99 ? what is that ?
it looks like a visual C++ Compiler error
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|