|
You understood it correctly; but the bad news is that I cannot modify the design of the library which is embedded in my assembly. I have these callbacks fired from the lib-file's worker thread.
I have thought about BeginInvoke myself, but in this case I cannot hide the dispatching process from the user (or can I?), because it must be implemented in the app's event handler - so the user has to write that code himself.
I would need that dispatching process in between the callback from the worker thread in the lib file and the event handler.
|
|
|
|
|
Have a deeper insight on BeginInvoke I realized that I could also do this on the event's delegate. So more or less I could start the invocation within my assembly;
anyhow, I can't get it work in C++/CLI, because either the event is not recognized as a data member (seems to be a C++/CLI specific behavior, as I read so far) or the AsyncCallback structure will not work, grrr.
Does anyone have a short code snippet how to invoke some event in C++/CLI correctly?
|
|
|
|
|
Don Rolando wrote: Does anyone have a short code snippet how to invoke some event in C++/CLI correctly?
I never looked at the them but I bet you will find an example in the introductory CLI articles here on CodeProject. Look under the "Chapters" menu.
led mike
|
|
|
|
|
Don Rolando wrote: I cannot modify the design of the library which is embedded in my assembly. I have these callbacks fired from the lib-file's worker thread.
Don Rolando wrote: I cannot hide the dispatching process from the user (or can I?), because it must be implemented in the app's event handler - so the user has to write that code himself.
That information is very confusing. If it is your assembly, why can't you modify it?
led mike
|
|
|
|
|
The assembly is from me, right... but not the linked lib-file which generates it's own worker threads and calls the callbacks. That's kind of a black box which's architectural design I cannot modify in any way.
But I can try to start the dispatching when firing the event out of these callbacks. That's still within the assembly (but would however not beautify the general architecture),
Silly thing is that I could not find examples for BeginInvoke on delegates for C++/CLI so far... only on controls or in C#; and I read that C++/CLI is different in that case and cannot be handled the same way... but I will get it work soon, I am sure.
|
|
|
|
|
Hello all,
I'd very grateful for your help with compilation error I get after migrating from Visual Studio .NET 2003 to Visual Studio 2005.
class A is a managed class which contains pointer pPtr to unmanaged class as public member
class B is a managed class, derived from A.
In constructor of B there is an initialization of pPtr
after migrating from Visual Studio .NET 2003 to Visual Studio 2005 I get a compilation error:
cannot access a private member of class A (pPtr)
I'm using Old Syntax.
Thanks in advance,
Maya
|
|
|
|
|
mayag wrote: I'm using Old Syntax.
I don't recommend that.
As to your problem the newer C++ compilers are more standards compliant than the old ones. private is private, as in, not visible to derived classes. If you want derived classes to access the member make it protected, although this is not a normal design holding the principle of encapsulation but that is another matter.
Also Microsoft maintains a page of the breaking changes between compliers which could help you. There are also like a migration guide or something. Also here on CodeProject there exists an excellent set of articles introducing the CLI language extensions, I highly recommend those to anyone new to CLI.
led mike
|
|
|
|
|
i have a major problem with the HtmlDocument HtmlElement ... methods...
im tryn to code a browser in wich i can automaticle fill a form and submit it.
this is the form code <code>form name="loginform" method="POST" action="/login.php">
<input class="loginname" type="text" name="name" value="" style="width:8em;" maxlength="60" />
<input class="passwort" type="password" name="password" value="" style="width:8em;" maxlength="60" />
<input type="submit" name="login" value="Login" style="width:7em;" /><br /></code>
this are my attempts
<code> HtmlDocument ^doc = webBrowser1->Document;
label1->Text = doc->Title->ToString();
//HtmlElement ^feld1 = webBrowser1->Document->GetElementsByTagName("name");
//HtmlElement ^feld1 = webBrowser1->Document->Forms->GetElementsByName("loginname");
//feld1->SetAttribute("HALLO",name);
//doc->GetElementsByTagName("loginname");
HtmlElementCollection ^feld2 = webBrowser1->Document->Forms;
feld2->GetElementsByName("loginname");
//HtmlDocument ^feld2 = webBrowser1->Document->Forms->GetElementsByName("name");
//feld2->SetAttribute("Hallo",name);
//HtmlElement ^button = webBrowser1->Document->GetElementById("Login");
//button->InvokeMember;
//HtmlInputDocument ^name = doc("name",0);
//doc->HtmlDocument::Forms::get();
//doc->GetElementsByTagName("login");
//doc->Forms->GetElementsByName("login");
//doc->GetElementById("login")</code>
can anyone help me with this? i'm desperated
|
|
|
|
|
Is there some specific reason you don't just make a HTTP Post request?
led mike
|
|
|
|
|
well i like to understand this methodes. because i need them later to find links and pictures in the document
|
|
|
|
|
I assume you are working inside of DOM from the web browser object?
If so you directly interact with the elements them self, no need to try to submit the post directly as the browser object will do that for you.
System::String^ part = "XYZ";
HtmlElement^ x = WebBrowser::Document::GetElementById("PartNum");
if (x != nullptr)
{
x->SetAttribute("value", part);
x = WebBrowser::Document::GetElementById("Submit");
if (x != nullptr)
{
x->InvokeMember("click");
}
}
|
|
|
|
|
How do I read in words from a text file one at a time? I do not want the blank space or puncuation.
The file is long.
|
|
|
|
|
While there's still data in the file
{
Read an arbitrary amount of the file
Loop through the data read, parsing out the words
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
So like this?
while (!eof())<br />
while (fin != '\n')<br />
{<br />
fin >> words[i];<br />
i++;<br />
}<br />
}
|
|
|
|
|
Something like that should work, although it looks like you're parsing lines, not words.
Many stream classes have built-in support for reading lines of text, but I know of none that
parse words.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The thing is I need to read them in from a file. Then check then againest the words before it and place them in a binary tree and if that word is in the tree I need to increament a counter to show that there are 2 or have ever many of that word are in the file.
Cary
|
|
|
|
|
|
led Mike.
thanks so much this is a great help.
|
|
|
|
|
Okay I have a question
const int MAX = 30;<br />
char fileName[MAX];<br />
char name[MAX];<br />
cout << "enter the file name: " << endl;<br />
cin >> name;<br />
fileName = name + ".txt";
My question is when I try and compile this it give me this error.
invalid operands of types `char[30]' and `const char[5]' to binary `operator+'
What is wrong with this code. I was told it is correct however I can not get it to compile.
led mike thanks for the great help on the last problem.
modified on Wednesday, April 2, 2008 3:55 PM
|
|
|
|
|
Cary D. Rutherford wrote: What is wrong with this code.
You can't concatenate char arrays like that in C/C++.
Here's one way you could build fileName:
strcpy(fileName, name);
strcat(fileName, ".txt");
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark. I was told wrong. I thank you for clearing this up for me.
Now it works and I understand.
Thank you again.
Cary
|
|
|
|
|
hi
i have to add the gif file into to my datagrid.
i was very new to vc++ dotnet application. i tried to load gif file like bitmap file, it display the image not the action in the file.
how do i import gif file into datagrid??
thanks in adv
shivapalanirajan k.
iam a software engineer working for varisis technologies bangalore
|
|
|
|
|
I cannot run my application .exe on other pc. Error message like this "The application has failed to start because the application configuration is incorrect. Reinstall the application may fix the problem." But I can open the application on my own pc which I built and debugged the application. What may be the problem?
|
|
|
|
|
Member 4542272 wrote: What may be the problem?
The problem very likely is that you have not fulfilled your responsibility as a developer and read the MSDN Documentation on Deployment for the tools you used in constructing your application. Did I get it right?
led mike
|
|
|
|
|
I am still a student. Every semester I change to use different software depend on the project. Frankily speaking, this is the first time I use visual studio. I do admit that I have skipped the MSDN Documentation due to the time constraint. I just did the coding, built and debugged it to come out the .exe file then assumed that it can be run on same window platform on other machine. Did my answer statisfy you?
|
|
|
|