|
hm.. no one's replying. Does this mean this is not possible?
|
|
|
|
|
Rafferty Uy wrote: hm.. no one's replying. Does this mean this is not possible?
No. It menas, nobody read it that would know the answer, or are too lazy to write it down.
ps: I don't know the answer
|
|
|
|
|
I realize that error descriptions have gotten better, but they still need to come a long way. I will post both my error message and code in hopes that someone can help me out with this, because I am lost.
error:
error C3767: 'JensonDispatch::DataOperations::DataOperations': candidate function(s) not accessible c:\documents and settings\kathy\my documents\visual studio 2005\projects\jenson dispatch\jenson dispatch\MainForm.h 24
DataOperations.cpp
<br />
#include "StdAfx.h"<br />
#include "DataOperations.h"<br />
<br />
namespace JensonDispatch<br />
{<br />
DataOperations::DataOperations(void)
{<br />
}<br />
<br />
DataOperations::~DataOperations(void)
{<br />
}<br />
<br />
int DataOperations::ConnectToDataStore(SqlConnection^ conn, String ^query)<br />
{<br />
try {<br />
SqlCommand^ sqlComm = gcnew SqlCommand(query, conn);<br />
sqlComm->ExecuteNonQuery();<br />
MessageBox::Show("Connected!");<br />
}<br />
catch (Exception^ e) {<br />
MessageBox::Show("Error!", e->ToString());<br />
}<br />
return 0;<br />
}<br />
<br />
int DataOperations::DisconnectFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
} <br />
<br />
int DataOperations::AddCallToDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::RemoveCallFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::AddCustomerToDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
<br />
int DataOperations::RemoveCustomerFromDataStore(SqlConnection^ conn, String^ query)<br />
{<br />
return 0;<br />
}<br />
}<br />
DataOperations.h
<br />
#pragma once<br />
<br />
namespace JensonDispatch<br />
{<br />
using namespace System;<br />
using namespace System::Data::SqlClient;<br />
using namespace System::IO;<br />
using namespace System::Windows::Forms;<br />
<br />
public ref class DataOperations<br />
{<br />
DataOperations(void);<br />
~DataOperations(void);<br />
public: <br />
int ConnectToDataStore(SqlConnection^, String^);<br />
int DisconnectFromDataStore(SqlConnection^, String^);<br />
int AddCallToDataStore(SqlConnection^ , String^);<br />
int RemoveCallFromDataStore(SqlConnection^, String^);<br />
int AddCustomerToDataStore(SqlConnection^, String^);<br />
int RemoveCustomerFromDataStore(SqlConnection^, String^);<br />
};<br />
}<br />
MainForm.h:
<br />
#pragma once<br />
#include "DataOperations.h"<br />
<br />
namespace JensonDispatch <br />
{ <br />
using namespace System;<br />
using namespace System::ComponentModel;<br />
using namespace System::Collections;<br />
using namespace System::Windows::Forms;<br />
using namespace System::Data::SqlClient;<br />
using namespace System::Drawing;<br />
<br />
public ref class MainForm : public System::Windows::Forms::Form<br />
{<br />
public:<br />
MainForm(void)<br />
{<br />
InitializeComponent(); <br />
MainForm::AddCallRadioButton->Checked = true;<br />
MainForm::AddLookupButton->Text = "Add Call";<br />
String^ ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=""C:\\ProgramFiles\\Microsoft SQL Server\\MSSQL.\\MSSQL\\Data\\ServiceCalls.mdf"";<br />
Integrated Security=True;Connect Timeout=30;User Instance=True";<br />
SqlConnection^ SqlConn = gcnew SqlConnection(ConnectionString);<br />
String^ QueryString = "";<br />
DataOperations^ dOps = gcnew DataOperations();
<br />
dOps->ConnectToDataStore(SqlConn, QueryString);<br />
}<br />
<br />
protected:<br />
~MainForm()<br />
{<br />
if (components) {<br />
delete components;<br />
}<br />
}<br />
#pragma region MainForm Components<br />
#pragma endregion<br />
#pragma region Windows Form Designer generated code<br />
#pragma endregion<br />
<br />
private: System::Void AddCallRadioButton_CheckedChanged(System::Object^ sender, <br />
System::EventArgs^ e) {<br />
if (MainForm::AddCallRadioButton->Checked)<br />
MainForm::AddLookupButton->Text = "Add Call";<br />
if (MainForm::LookupRadioButton->Checked)<br />
MainForm::AddLookupButton->Text = "Search";<br />
}<br />
};<br />
}<br />
Also, if anyone sees that I'm doing something blatently wrong or has contructive criticism, please by all means let me have it
Thanks,
John
|
|
|
|
|
Your class, DataOperations, has a private constructor (ctor), DataOperations(), and a private destructor, dtor, ~DataOperations(). I believe your program requires your ctor and dtor to be public.
|
|
|
|
|
ah ha! working now. thanks a lot. I thought default constructors were public by default.
thanks again!
Thanks,
John
|
|
|
|
|
i need to supply the name of the XML document when i run the program,,is it right what i did?
it didn't work? how can i make it plz?
#using<<mscorlib.dll>>
using namespace System;
#using <<system.xml.dll>>
using namespace System::Xml;
int main(int argc, char* argv[])
{
//check for required arguments
if (argc <2)
{
Console::WriteLine("Usage :CppXmlTextReader path");
return -1;
}
String^ path = gcnew String(argv[1]);
try
{
//create the reader...
XmlTextReader^ rdr = gcnew XmlTextReader(path);
//Read nodes
while (rdr->Read())
{
//do something with the data
}
//read nodes
while (rdr->Read())
{
switch (rdr->NodeType)
{
case XmlNodeType::XmlDeclaration:
Console::WriteLine("->XML declaration");
break;
case XmlNodeType:ocument:
Console::WriteLine("->Document node");
break;
case XmlNodeType::Element:
Console::WriteLine("->Element node, name{0}",rdr->Name);
break;
case XmlNodeType::EndElement:
Console::WriteLine("->End element node,name={0}",rdr->Name);
break;
case XmlNodeType::Text:
Console::WriteLine("->Text node,value={0}",rdr->Value);
break;
case XmlNodeType::Comment:
Console::WriteLine("->Comment node, name={0},value={1}",rdr->Name,rdr->Value);
break;
case XmlNodeType::Whitespace:
break;
default:
Console::WriteLine("**UnKnown node type");
break;
}
}
}
catch (Exception^ pe)
{
Console::WriteLine(pe->ToString());
}
return 0;
}
-- modified at 15:54 Monday 13th March, 2006
|
|
|
|
|
Try using "int main(array<System::String ^> ^args)" instead of "int main(int argc, char* argv[])"!
|
|
|
|
|
i got the following error:
error c2693: '<':illegal comparison for references to a managed array when i check on arguments,,how can i solve it? how about the constructor?
|
|
|
|
|
// In C++/CLI the "exe" name is not included in the argument array.
// If your path has has spaces, be sure to surround it with quotes.
// Example CppXmlTextReadr "c:\program files\file.xml"
int main(array<System::String ^> ^args)
{
if (args->Length < 1)
{
Console::WriteLine("Usage :CppXmlTextReader path");
return -1;
}
String^ path = args[0];
Console::WriteLine(path);
return 0;
}
|
|
|
|
|
Excuse me, Sorry,,but i don't know where to place the path of the XML file,,
when i run my program in the command line i write it? or how?
|
|
|
|
|
If you are talking about running your program from Visual Studio, here is what you do:
1. Right-click on your project.
2. Click on "properties"
3. Under "Configuration Properties", click on "Debugging".
4. On the right of the window, you will find "Command Arguments". Place your arguments there.
Peace
|
|
|
|
|
Hello all people,
I need make a application that update the BIOS information:
Vendor name, BIOS Version, BIOS build date and more.
I used to know that I have to use the 52h function. I don´t know how complex is this task.
That app must run on DOS.
I really need that. Can be Basic, QBasic, Fortran, Cobol, Assembler, C/C++. Any DOS suported language!!
thanks all!
|
|
|
|
|
C++/CLI does not run in DOS. You may not get your answer here!
|
|
|
|
|
|
Hello all people,
I need make a application that update the BIOS information:
Vendor name, BIOS Version, BIOS build date and more.
I used to know that I have to use the 52h function. I don´t know how complex is this task.
somebody have a code to make this. may be in any language ( mainly in C/C++).
thanks all!
|
|
|
|
|
C++/CLI does not run in DOS. You may not get your answer here!
|
|
|
|
|
a dll not had source, how know it parameter's number and is WINAPI or CDECL?
|
|
|
|
|
Since you posted in the C++/CLI forum, you implicitly admit your DLL was written in .NET. If you were lying and this DLL was not written in .NET then you have just posted in the wrong message board. Repost this question in the message board.
Note that in .NET, CLR functions only have one calling convention, and that is __clrcall. The WINAPI or CDECL stuff only applies to native DLLs. If your function has uses WINAPI/CDECL, then your function is not written in .NET (see above).
Also note that .NET DLLs do not export their CLR functions as dllexports. Instead, the functions are stored as Metadata, and are discovered using Reflection.
The quick way to check the function signature is to add the DLL as a project reference (Project -> References -> Add New Reference -> Browse -> select your DLL -> OK OK). If this doesn't work, then your DLL is not a .NET DLL (see above).
Now click on view Object Browser, and go down to the namespace of the DLL. This will show you all the function signatures in that DLL.
How do you do this programmatically?
The functions to use are given in System::Reflection. Once you have the System::Assembly of the DLL, call the Assembly::GetTypes method to get all the types of the assembly. Then you can call the GetMethods to get the methods in that Type (including private ones).
To get the number and type of parameters, check out MethodInfo::GetParameters. That should allow you to discover the signature of the method.
|
|
|
|
|
Alright say we have the following template class:
<br />
template <class T><br />
class Data {<br />
public:<br />
Data() : data(0) { } <br />
Data(T buff) : data(buff) { }<br />
void updateData(T buff) { data = buff; };<br />
T returnData() { return data; };<br />
private:<br />
T data;<br />
};<br />
is there anyway to find out which type was sent to the template argument T (such as int, char*, double, etc.)?
i would like to use an if or switch statement inside one of the classes functions such as:
<br />
void Data<T>::someFunction() {<br />
if (T == int) {
} else {
.. do this<br />
}<br />
}<br />
Thanks in advance for any help.
Carl
|
|
|
|
|
|
Is it possible if you could post a code fragment with an example of template specialization?
Thank you,
Carl
|
|
|
|
|
template <class T>
ref class Message
{
public:
void foo() { Console::WriteLine("Called Message<T>::foo()"); }
};
// Specialization
template <>
ref class Message<long>
{
public:
void foo() { Console::WriteLine("Called Message<long>::foo()"); }
};
int main(array<System::String ^> ^args)
{
Message<String^> ^stringMessage = gcnew Message<String^>;
Message<long> ^longMessage = gcnew Message<long>;
stringMessage->foo();
longMessage->foo();
return 0;
}
|
|
|
|
|
I have a little graphics demo to demonstrate a transformation class I'm doing and the Sleep() function seems to be working incorrectly. The program is a little tank that the user can move around with the keyboard. I use sleep on every cycle to try to slow down the frames per sec so the tank is controllable. If I omit Sleep() the program seems to run correctly, the tank is very quick and uncontrollable. I want to slow it to about Sleep(4) but when I use this it slows much more than 4 milliseconds per frame. From about Sleep(1) to Sleep(50) it's the same slow pace. Over 50 and it works correctly slowing in increments according to the number of milliseconds.
If anyone has had a similar problem or can just offer some advice it would be much appreciated.
I'll include a little code, if not enough please tell me.
I call Sleep() at the end of this function.
This is my function for glutIdleFunc(myIdle). It runs myIdle while the function has no imput.
void myIdle()
{
glClear(GL_COLOR_BUFFER_BIT);
if(upPressed == 1 && userBullet.getBulletCheck() == 0)
{
if(userBullet.getBulletCheck() == 0)
{
userBullet.setBulletStart(userTank.getBulletStart());
userBullet.setBulletCheck(1);
userBullet.setBulletDirection(userTank.getCurrentTurretDir());
}
userTank.drawTank();
}
if(wPressed == 0 && sPressed == 0 && aPressed == 0 && dPressed == 0 && rightPressed == 1 && leftPressed == 0)
{
userTank.rotateTurret(1);
userTank.drawTank();
}
/**In between these two code chunks is just more of the same, different operatios for different button presses.**/
if(sPressed == 1 && wPressed == 0 && dPressed == 1 && aPressed == 0 && rightPressed == 0 && leftPressed == 1)
{
userTank.rotateTurret(-1);
userTank.moveTankBck();
userTank.rotateBody(1);
userTank.drawTank();
}
userTank.drawTank();
if(userBullet.getBulletCheck() == 1 )
{
userBullet.moveBullet();
}
Sleep(4);
glutSwapBuffers();
}
-- modified at 19:05 Saturday 11th March, 2006
|
|
|
|
|
Sleep won't do what you are looking for because for so low sleep time, it is not accurate at all due to the non-real time behavior of the operating system. As windows is not a real-time OS, precision under 10 or 15 msec is unachievable. Instead of what you are doing, prefer another method: make a loop that will get the time and update your program every X msec:
int PastTime = GetTickCount();
while (true)
{
int TimeElapsed = GetTickCount() - PastTime;
if (TimeElapsed >= 30)
{
}
}
This code will update your program every 30 msec.
|
|
|
|
|
Correct me if i am wrong, but wouldn't it be better to use a timer instead of a while loop? As far as i am aware of while(true) it would mean active waiting and this will cost you valuable cpu time.
|
|
|
|
|