|
Aha I see the logic in this now. It's funny how something so fundamentally obvious can completely escape my thought process haha.
Anyway, thank you very much It appears to work now
|
|
|
|
|
I'm trying to control a website through the WebBrowser control and have the scraping and navigation sorted but have one issue to resolve.
There are radio buttons that have to be clicked on, does anyone have a suggestion on how to do this?
Thanks.
Elaine
|
|
|
|
|
Trollslayer wrote: There are radio buttons that have to be clicked on, does anyone have a suggestion on how to do this?
Do you mean you need to POST to the server? Also you are using C++/CLI for this?
|
|
|
|
|
It is to control a normal web page which has some text boxes, radio buttons and a submit button.
I'm using manged code for this.
|
|
|
|
|
|
You didn't state what you're using for UI, but if you Google
"master detail" along with your UI technology (Windows forms,
WPF, etc.) that should get you many examples...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Anybody has idea how to start specific service in remote machine using WMI C++ API.
|
|
|
|
|
|
|
Hi There.
I am not able to use C# Managed DLL into my VC++ Application (DLL).
Below are the steps I am doing but with no success.
1. Copied C# DLL into the folder where all my lib files reside.
2. Included #using :GT:JPEGMaker.dll:LT: statement into stdafx.h file
3. After this I got an error message regarding CLR Support, so I enabled the same in project settings.
4. After this I got a linking error...
:GT: Greater Then Sign
:LT: Less Then Sign
Please provide details or Do I need to convert C# DLL into Native DLL?
Thanks
PanB
|
|
|
|
|
|
I have a VC++ application(say MathApp) that does some mathematical calculations using some U/I inputs, and gives the results. I have a C# application(say ManagedApp) that wants to interact with MathApp. ManangedApp has to pass the inputs to MathApp, MathApp should perform the calculations, and give back the results to ManagedApp.
Can someone suggest different ways to accomplish the above task?
|
|
|
|
|
Rinnu Mary wrote: I have a VC++ application(say MathApp)
communicating between processes is a well known topic called Inter-Process Communication[^]
However if the MathApp code is designed well the math routines would be separated from the user interface code and they can be built into a library that can then be used by other applications at compile time. This eliminates the need to have two processes involved at runtime and therefore eliminates the IPC scenario.
After that it is a matter of dealing with the Native code to Managed code problem. This is where C++/CLI comes in. You can develop a .NET assembly (library) using C++/CLI that contains the C++ MathApp code as well as a managed class of your own design that encapsulates the native code. Once done C# projects can reference this assembly and use the managed class from it to execute the native code contained within the DLL (assembly).
|
|
|
|
|
|
I would like to copy file from local to remote machine using WMI in C++. Not quite sure how to do this.
According to MS doc, "Win32_Directory" can be a good candidate. Anybody got idea? Thanks in advance.
Jack Rong
|
|
|
|
|
I'm attempting to pass a String^ variable to a function and updating the variable within the function. When I return from the function I want the updated variable to be what was assigned in the function. (I'm still trying to learn the Managed C++ coding and can't find a good example.)
#include "stdafx.h"
using namespace System;
void ChangeString(String^);
int main(array<system::string xmlns:system="#unknown"> ^args)
{
String^ Outside = gcnew String("Outside");
ChangeString(Outside);
Console::WriteLine(Outside);
return 0;
}
void ChangeString(String^ variable)
{
Console::WriteLine("Recieved: {0}",variable);
variable = "Changed";
Console::WriteLine("New: {0}",variable);
};
George
|
|
|
|
|
System.String is immutable - you cannot change the string's contents
once it's initialized.
You could use a System.Text.StringBuilder instead, which is mutable.
You could also return a new System.String instead of trying to modify the
passed String.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
void ChangeString(String %^ variable)
Mark is right - System::String is immutable - but that's fine: a new one is passed back if you use '%'.
I think StringBuilder is overkill for this - StringBuilder, as its name implies, is for building up large strings - you'll not gain anything by using it in cases like this.
David Anton
http://www.tangiblesoftwaresolutions.com
Convert VB to C#, C++, or Java
Convert C# to VB, C++, or Java
Convert C++ to C#, VB, or Java
Convert Java to C#, C++, or VB
|
|
|
|
|
I've got my Visual C++ form to display properly based on whether or not the user is using XP or Vista, but I need the program to open up with Administrator rights on Vista. I've tried doing it based on file existence, but even if the file is not created it shows that "it exists" because there is an open filestream. There are also random message boxes I used to verify that I was using the updated version of this app.
This is my code so far:
(If there are any bracket errors, please ignore, the code compiles fine, I just copied a portion of the code from the header file)
public: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
bool retValue;
bool ret;
String^ path = "C:\\Program Files\\CenturyTel Self Repair\\VistaUAC.fts";
if (File::Exists(path))
{
MessageBox::Show("Successful second time loading.","Beta 2");
}
else
{
retValue = OsIsAtLeastVista(); // Returns true if user has Vista
if (!retValue)
MessageBox::Show("NOTE: This is XP.","Beta Test");
MessageBox::Show("Second Box?!","Yup");
if (retValue)
{
MessageBox::Show("NOTE: this is Vista","Beta Test");
if (File::Exists(path))
MessageBox::Show("Voila! File was created.","Hehe, worked.");
else
{
MessageBox::Show("Creating File.","Creating file.");
FileStream^ fs = gcnew FileStream(path,FileMode::OpenOrCreate,FileAccess::Write );
try
{
AddText(fs, "I exist\n");
fs->Close();
}
finally
{
if (fs)
delete (IDisposable^)fs;
}
ret = subFunc();
if (File::Exists(path))
MessageBox::Show("I'm here.","I'm here.");
if (!ret)
{
System::Diagnostics::Process ^process = gcnew System::Diagnostics::Process();
process->StartInfo->FileName = "CTEL.exe";
process->StartInfo->Verb = "runas";
process->Start();
Application::Exit();
}
}
}
}
and the subfunc
bool subFunc ()
{
bool val;
if (File::Exists("C:\\Program Files\\CenturyTel Self Repair\\VistaUAC.fts"))
val = 1;
else
val = 0;
return val;
}
|
|
|
|
|
|
Does it have to be run with the manifest or is there any way to just have the application open with that as long as it's Vista?
|
|
|
|
|
turkmeistr1 wrote: Does it have to be run with the manifest
The manifest is always checked anyway, so what's the difference?
If your app requires administrative privileges, then that's how you do it, otherwise
any operations requiring elevated privileges will fail at runtime.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I forgot to mention - if you need your app to run not elevated at first
and then maybe elevate privileges later if necessary based on some logic,
then you can launch a separate process elevated using "runas" ike we discussed
previously.
Hopefully that made sense
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'm trying to draw this rotating line onto a picture box instead of a form.
My question is: how do you specify that the FillRectangle and DrawLine statements should be applying to the picture box instead of the form on which it has been placed.
Here's the code:
private: System::Void timer1_Tick(System::Object * sender, System::EventArgs * e)
{
myAngle = myAngle + (tSpeed*.004);
if (myAngle > 6.283) myAngle = myAngle-6.283;
Graphics* pg = CreateGraphics();
SolidBrush* sb= new SolidBrush(Color::LightGray);
pg->FillRectangle(sb,10,10,200,200);
point1=100 + 80*sin(myAngle);
point2=100 - 80*cos(myAngle);
Pen* pen1 = new Pen(Color::Black);
pg->DrawLine(pen1, 100,100,point1,point2);
pg->Dispose();
}
Thanks for any suggestions.
Jeff
|
|
|
|