|
|
I am working on AD RMS so can u plz tell me that how to get the machine certificate and
how to get the User License and How to get RAC(Rights Account Certificate)
PLease tell me that what is needed the first.
|
|
|
|
|
|
Hi All,
I am Savitri Here. I new to VC.Net.I am using visual studio 2005.In this i am doing one small program. I started the project like CLR->Windows Application. In that initially Form1 was created.In that i added one more Windows Form called Loginform. I am accessing functions and variables from loginform to Form1 by adding #include "LoginForm.h" in form1.h. But i want access functions of Form1 into LoginForm class,in this i am facing problem and i was not able to include "Form1.h" in LoginForm. Why it is giving problem i am not understanding? Please give me some solution or hints from that i will solve the problem. Please tell me any good books for vc.net and i want some samples of vc.Net.Please help me out.
Thanks in advance to all.
Regards,
Savitri P
|
|
|
|
|
Hi Savitri,
savitri wrote: Why it is giving problem i am not understanding?
If you do that, you will get circular reference. This is the reason for all those errors. You need to forward declare Form1 inside LoginForm and include form1.h in LoginForm.cpp and use the methods from Form1 .
ref class Form1;
public ref class Loginform : public System::Windows::Forms::Form
{
}
#include "form1.h"
void Loginform::SomeMethod()
{
} savitri wrote: Please tell me any good books for vc.net and i want some samples of vc.Net
1 - C++/CLI in action[^]. (This is my favorite)
2 - Visual C++/CLI and the .NET 3.5 Platform[^]
|
|
|
|
|
Hi,
Thanks for suggestions.But still i have one doubt. That is shall i create object in constructor or what? or without that how can i use methods of form1 in loginform. Help me please.
Thanks in advance.
Regards,
Savitri P
|
|
|
|
|
Pass the Form1 object via LoginForm 's constructor.
|
|
|
|
|
Hi Navaneeth,
Thanks for your reply.I have one more doubt hot we can inherit the classes in vc.net programming. Like in C# i have one class called xyz this is normal class not window form. and one more class called save this is windows form. they wrote like this. partial class save: public xyz{ //code here}. Like this how can i write in vc.net or else is der another way to access one class into other class. Please help me out.
Thanks in advance.
Regards,
Savitri P
|
|
|
|
|
If you derive xyz from save, and save is a form, then xyz is a form too.
Is that really what you want?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
savitri wrote: they wrote like this. partial class save: public xyz{ //code here}.
Is this C#? If yes, it is not valid/ Like c++, you don't specify access modifiers when inheriting.
savitri wrote: Like this how can i write in vc.net
AFAIK, C++/CLI doesn't support partial classes.
You said XYZ is a normal class and Save is a windows form. If yes, how can Save derive from XYZ ? It has to derive from System::Windows::Forms::Form or it's children.
savitri wrote: is der another way to access one class into other class. Please help me out.
You have to include classes header file and use it. What is the confusion here? Your question is not clear enough to answer.
|
|
|
|
|
Hi,
Ya i have to include header files to access the functions and variables of that class. thanks for ur guidance. I got the soft copy of that book what u specified in previous reply.
In VC.NET i have 2 windows forms Called Form1 and Form2.
I am including form2.h in form1 and accessing all the functions of form2.
But when i am including form1.h in form2 then i am getting error and not able to access the functions.
After that i did like this.
ref class form1;and created object of form1 in form2 constructor and when i called form2 frm=gcnew form2(this);
and also i am getting error like base class undefined for this code public ref class form2: form1
{//code here
}
Sorry if i written something wrong.I am new to this .net.Please help me to learn this.
Thanks in advance.
Regards,
Savitri P
|
|
|
|
|
Can you post code for Form1 and Form2?
|
|
|
|
|
Hi Navaneeth,
I am writing here code of form1 and form2.
form1.h
#pragma once
#include "AboutApp.h"
#include "LoginForm.h"
#using <mscorlib.dll>
namespace NewMDIApp {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Runtime::InteropServices;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
this->AccessibleRole = System::Windows::Forms::AccessibleRole::MenuBar;
this->AllowDrop = true;
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage")));
this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
this->ClientSize = System::Drawing::Size(1017, 700);
this->Controls->Add(this->statusBar1);
this->Controls->Add(this->statusStrip1);
}
#pragma endregion
public:
[DllImport("user32.dll",EntryPoint="GetKeyState")]
static int GetKeyState(int keyCode);
[DllImport("user32.dll",EntryPoint="keybd_event")]
static void keybd_event(Byte bVk, Byte bScan, UInt16 dwFlags, int dwExtraInfo);
public: static LoginForm^ lgFrm=gcnew LoginForm;
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
this->UpdateKey();
AboutApp^ app=gcnew AboutApp(this);
app->txtUsr->Text="Savitri";
app->Show();
}
AboutApp.h(Form2)
#pragma once
#using <mscorlib.dll>
namespace NewMDIApp {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
ref class Form1;
public ref class AboutApp : public System::Windows::Forms::Form
{
public:
AboutApp(Form1^ frm)
{
InitializeComponent();
frm1=frm;
}
protected:
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
}
#pragma endregion
private:
System::Void textBox1_TextChanged();
public:
Form1^ frm1;
private: System::Void btnLogin_Click(System::Object^ sender, System::EventArgs^ e) {
String ^username,^password;
username=txtUsr->Text->ToString();
password=txtPwd->Text->ToString();
MessageBox::Show(username);
MessageBox::Show(password);
if(username->Equals("Savitri") && password->Equals("Pramod"))
{
MessageBox::Show("SuccessFully Logged in");
textBox1_TextChanged();
}
else
{
MessageBox::Show("Not valid UserName and Password");
}
}
AboutApp.Cpp
#include "StdAfx.h"
#include "AboutApp.h"
#include "Form1.h"
System::Void NewMDIApp::AboutApp::textBox1_TextChanged(){
if(frm1 != nullptr)
frm1->GetValues(txtUsr->Text,txtPwd->Text);
}
Please give me some hints to solve this problems.
Thanks in advance.
Regards,
Savitri P
|
|
|
|
|
I am using unmanaged VC++ 6.0 console application which uses managed dlls written in C#. The VC++ application access managed dll through a interop layer written in C++/CLI. The functions in interop layer are exposed to VC++ 6.0 application by using 'extern "C"' as function library.
Everything works fine with the console application.
However when I convert the same console application to windows service using Win32 APIs StartServiceCtrlDispatcher() and RegisterServiceCtrlHandler() and ServiceMain() functions. The service created and started successfully, however when I stop the service, the application gives following error in event viewer.
Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event ID: 1000
Description:
Faulting application ivrs.exe, version 0.0.0.0, stamp 4a07da05, faulting module unknown, version 0.0.0.0, stamp 00000000, debug? 0, fault address 0x00000000.
Could anybody help me in this?
|
|
|
|
|
Thanks for looking at my question!
I am trying to figure out how to determine if a user-inputted file name exists, and I am completely unsure how to do this in .net C++.
I have tried just using the C fopen code:
if (fopen(String::Concat(room, ".txt"), "r") == 0)
(room is the inputted variable name, and .txt is obviously the file extension)
But I get a "cannot convert System::String ^ to const char *" error. I am assuming this is because fopen requires a constant name like "Bedroom.txt" and wont accept a variable as part of the name, so I need help determining another way to see if a file exists.
Any help would be greatly appreciated. Thanks!
|
|
|
|
|
Try Google.[^] For this method, I believe you'll need the full path. I would also recommend reading up on the System.IO namespace.
Dybs
|
|
|
|
|
Lol thanks! I actually just did this right before you linked me.
But um, since I'm here. You wouldn't happen to know how to get the string value of a selected item in a list box would you?
|
|
|
|
|
listBox1.SelectedItem.ToString()
Dybs
|
|
|
|
|
Hmm I must be doing something wrong with a different part of my code then.
I am trying to delete a file (in the same directory as the application) with a name that is respective to whats in a list box.
For example there is a "doom.txt" file and the word "doom" in my list box. I select doom and hit the delete button and the "doom.txt" file should disappear. (what I'm doing is actually more complicated, but this is the part I'm having trouble with)
Here is what my code looks like:
if (roomList->SelectedIndex != -1 && delCheck->Checked)
{
roomList->Items->RemoveAt(roomList->SelectedItem);
File::Delete(String::Concat(Convert::ToString(roomList->SelectedValue), ".txt"));
}
Any idea what I did wrong?
Thanks for all the help
|
|
|
|
|
you're removing the selected item from the list box. Then the next line you're trying to get the selected value (which will be null because you removed it already!). String::Concat will then create a string as ".txt". Now you're trying to delete a file called ".txt" which probably doesn't exist. It probably seems like nothing is happening because from MSDN[^] it says: Deletes the specified file. An exception is not thrown if the specified file does not exist.
You could do something like this:
if (roomList->SelectedIndex > -1 && delCheck->Checked)
{
int nIndex = roomList->SelectedIndex;
String ^sFileName = (String^)roomList->Items[nIndex];
if (!File::Exists(sFileName))
throw gcnew Exception("File does not exist!");
File::Delete(sFileName);
roomList->Items->RemoveAt(nIndex);
}
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
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.
|
|
|
|
|