|
bloodwinner wrote: I am using the MFC dialog application.
Then you're not using C++/CLI, are you ?
bloodwinner wrote: dlg.m_sum=dlg.m_add1+dlg.m_add2
I assume you have associated ints with the text boxes, not edit controls ?
Then you need to call UpdateData before you do the calculation, to bring down the variables, and UpdateData(FALSE) after the calculation, to populate the controls again. Or, maybe the other way around.
Please ask in the right forum next time
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
how to concatenate quotes to a string
supposed i want to display " Here is "my play ground" Enjoy" how we do please help me
thanks
abhi
abhi
|
|
|
|
|
|
Hi there,
Could any one tell me how I could disable user from viewing resources (i.e. dialogs, icons, menu, etc.) in an application exe file? I have an application that is written in unmanaged C++ in VS 2005 compiled with /clr option. Any help would be greatly appreciated.
Tony
|
|
|
|
|
Run a tool like UPX[^] on the binary.
|
|
|
|
|
Thanks Mike for the info. But I have a problem when I run it, it says.
upx: Myprogram.exe: CantPackException: .NET files (win32/net) are not yet supported
You know other software that support .net exe file?
Thanks
|
|
|
|
|
Hi!
What I'm trying to do is a tool that would help my at work with big number of open windows. It should:
1.Close window when I click middle button over titlebar of window (done)
2.Close window when I click over window's button in taskbar area.
The second one is for me too hard. I manage to catch mouse click using system hooks, but I don't know how to get HWND to specific button. I have whole taskbar handle insted. Sending WM_CLOSE couse closeing system :/.
How to get HWND of taskbar button that was clicked by mouse middle button?
Or how to acquire second goal other way?
Thank You for any help
Artur Tadrała
|
|
|
|
|
Hi, I'm wondering how I can remove the 'Close' button on a modal dialog. The reason is I don't want the user to accidentally close this partiulcar window, or at least display a confirmation to the user to ask whether if they really want to close it. I can't do that with the Form_Closing event as it stills closes it.
|
|
|
|
|
Set the Form.ControlBox property to false
led mike
|
|
|
|
|
Dear all,
I have been trying to send a string and read through Rs232 loop back null modem using the .net2 class serial port. The code is below:
the program sort of works but does not print "hello world", it prints the number 5, which is the byte size i am looking to print. i expected "hello" to print. any ideas as to where i am going wrong? many thanks.
void SendRs232Data()
{
serialPort->Open();
serialPort->Write("Hello World");
int offset = 0;//The offset in the buffer array to begin writing.
int count = 5; //The number of bytes to read.
array<unsigned char="">^ buffer = gcnew array<unsigned char=""> (10);//The buffer array to write the input to.
serialPort->Read(buffer, offset, count);
lblSerial->Text= (serialPort->Read(buffer, offset, count)).ToString();
serialPort->Close();
}
|
|
|
|
|
serialPort->Read(buffer, offset, count)
This function returns the number of bytes read.Since u have given the count value as 5,it would always return 5.Get the expected data from the buffer array
|
|
|
|
|
Thanks. Can you suggest what statment i need in ordr to read from the port?
|
|
|
|
|
Hi,
Delegates raised asynchrnosly does not raise in the invocation order.It executes randomly.How to make this delegate to be raised in the order it is invoked
Thanks in advance
Sangeetha
|
|
|
|
|
Hi,
i tried the CXImage Libary to create a multipage tif file. everything works fine! but for one project i need to split a multipage tif into several tif files.
how can i realise this by using the cximage libary? can anyone help me please?
thanks a lot!
|
|
|
|
|
*sigh* wrong forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
then please take it to the right forum section, or forward it... i dont know where to post else...
thx!
|
|
|
|
|
I'm afraid I can't move posts at the moment, I am having network problems while travelling.
The library in question is not written using C++/CLI, it's written in normal c++. Hence, as the forum for this article is no longer supported, the Visual C++ forum is the place to ask this.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Given something like this (assume everything public, VC++ 2003 old syntax)...
__gc class ManagedClass
{
AnotherManagedClass __gc *pAnotherManagedClass;
...
AnotherManagedClass __gc * GetAnotherManagedClass() {return pAnotherManagedClass;}
};
class UnmanagedClass
{
gcroot<ManagedClass *> pManagedClassObj;
...
void UnmanagedClassFunc();
};
Which of the following three is the safest/most-correct/least-overkill way to use the managed
object pointers from an non-GC class method:
void UnmanagedClassFunc()
{
pManagedClassObj->GetAnotherManagedClass()->AnotherManagedClassFunc();
}
or
void UnmanagedClassFunc()
{
gcroot<AnotherManagedClass *> pAnotherManagedClassObj;
pAnotherManagedClassObj = pManagedClassObj->GetAnotherManagedClass();
pAnotherManagedClassObj->AnotherManagedClassFunc();
}
or
void UnmanagedClassFunc()
{
AnotherManagedClass __pin *pAnotherManagedClassObj = pManagedClassObj->GetAnotherManagedClass();
pAnotherManagedClassObj->AnotherManagedClassFunc();
}
Thanks,
Mark
|
|
|
|
|
The first one is fine and is what you need to use.
|
|
|
|
|
Thanks much Nish.
So, pinning is only required if I passed the pointer to another unmanaged function?
There's no chance of the managed object moving during the call? I guess I'm thinking in terms of
a "this" pointer being a C++ guy.
Mark
|
|
|
|
|
Mark Salsbery wrote: So, pinning is only required if I passed the pointer to another unmanaged function?
There's no chance of the managed object moving during the call? I guess I'm thinking in terms of
a "this" pointer being a C++ guy.
Yeah, as long as you are accessing the managed pointer, you don't need to do pinning. But, if you are passing the managed pointer using a native pointer (for instance, when calling a native function), then you need to pin it. Because the native pointer will not be updated when the managed object it is pointing to gets relocated (if it does).
|
|
|
|
|
Ok, thank you very much Nish.
I'm a seasoned C++ programmer so I have "trust issues" with this managed code stuff
(in fact, I spent 6 hours one night convincing myself that garbage collection worked LOL).
I don't want to release code that mysteriously crashes because of some silly thing like this.
Take care!
Mark
|
|
|
|
|
Hi
I have written a plugin but don't know how to register it so that i can use it.
can anybody tell me how can i register a plugin.
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
saqib82 wrote: how can i register a plugin
plug in for what?
led mike
|
|
|
|
|
Write a C++ program that implements a very simple spell checker.
1. Specification
A spell checker is a program that verifies the spelling of words in a document. Your program should prompt the user to input some text, find out which words are misspelled and finally give output as described below.
The following is an example illustrating the behaviour of the program:
csh> ./ex3
Input text (enter END to stop):
Twinkle, twinkle, little ster,
How I wondre what you are
END
Extracted words:
Twinkle,twinkle,little,ster,How,I,wondre,what,you,are
Marked text:
Twinkle, twinkle, little #ster#,
#How# I #wondre# #what# #you# #are#
Input
When the program is executed, the user is requested to input multiple lines of text. The input is stopped when a line containing only "END" is entered. "END" will NOT be treated as part of the input text.
Processing
After the text is input, the program should determine which words are misspelled. A word is defined as a string of letters (upper or lower case) preceded and followed by a non-letter (e.g. space, tab, number,punctuation mark). It also includes strings of letters appearing at the beginning and/or end of a line.
For example, in the following input line:
How I wondre what@you are
Six words can be extracted:
How,I,wondre,what,you,are
After the words are extracted, the program should determine which are misspelled. Please see next section for details about misspelling checking.
replace it with your own information
output 1
output 2
continue inputting until
END is entered
Output
Finally, the program should output two things:
1) The extracted words with each word separated from the next one by a comma. The order of appearance of the words to be output should follow that of the input.
2) The input text with all misspelled words enclosed by a pair of '#'. Nothing else should be added or removed from the output.
2. Misspelling Checking
Your program must include a header file ex3.h which is to be provided by your instructor during marking.
The header file will look like the following:
// example of ex3.h - will be different during actual marking
#define MAX_WORDS 4
char dictionary[MAX_WORDS][20] = { "i", "twinkle", "little", "star" };
Your program must include ex3.h (located at the same directory of your source file) and make use of the
constant MAX_WORDS and the array dictionary to perform misspelling checking. E.g.
// your program will look like the following
#include <iostream>
#include <cstring>
...
#include "ex3.h" // ex3.h is provided by your instructor
int main()
{
...
// example of use of MAX_WORDS and dictionary
for (int i=0; i < MAX_WORDS; i++) {
... dictionary[i] ...
}
}
During debugging, you should create your own ex3.h to test your program.
In ex3.h, the constant MAX_WORDS specifies the number of strings contained within the array dictionary.
The array dictionary contains all the words you would use to check against the extracted words in the input text. If an input word cannot be found in dictionary, it should be considered a misspelled word.
The checking is case insensitive, e.g. "Twinkle" is equivalent to "twinkle"
As stated in the above section, misspelled words should then be enclosed by '#' in the output.
3. Important Points
1) You can assume that the maximum number of input lines is 100 and the maximum length of each line is
100 characters.
2) To input a line, you can use a statement like:
char buffer[200];
cin.getline(buffer, 200, '\n');
// buffer contains the input from the user, with the newline removed
3) The output should be a correct sequence of characters. You should NOT use a backspace to "erase" the
preceding character. For example, the following are NOT the same:
"abc<backspace><backspace>def" not the same as "adef"
|
|
|
|