|
Hi,I`m a c++ programer and newely I started to work with vc++.I have met a big problem, in windows Nt,Xp and newer versions of windows non of my programs dont work.but they work perfectly in win98 win Me and Dos os.So if it is possible, let us know about the classes and objectes in Vc++ that controls the hardware in windows.thanks
|
|
|
|
|
If u can post a code sample that is not working ,we can help you in fixing the problem.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
i think he needs to general information
whitesky
|
|
|
|
|
|
You are dealing with a security problem. I say this because you are talking about accessing the hardware and I assume that you mean directly. If you want to access the hardware then you need to call a driver to do it for you. On systems like Win2000 and XP you can not access the hardware directly (even in assembly) without it getting upset with you. It does not matter whether or not you are using VC++ or not, it is an OS thing. There is a public domain diver out there some where that will allow you to access hardware ports directly, I used it a couple of years ago and forget its name (so keep looking).
If you post a small example of the problem (in code) or explane what exactly you are trying to do, then someone here will probably be able to help you.
Good Luck,
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I have two questions.
1. How do I use ShellExecute inside my MFC program to register an activex control, say MyControl.ocx located at D:\MyFolder?
2. I do not want it to be in the hard disk, but would like to include the activex control within my program as a resource and then I want to register it. I imported it as a resource. How can I proceed?
Regards,
Aljechin Alexander
|
|
|
|
|
|
NiceNaiduUse DllRegisterServer
Exactly how is this of any help outside of the ActiveX file?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
1) u can use ShellExecute(NULL, NULL, "regsvr32.exe", <path to="" ocx="">, NULL, SW_HIDE);
2) you cant keep an ocx in the resourse and use it if you are doing static linking. if u are doing only dynamic lnking then, one thing you can do is to store the binaries from reourse into the harddisk and register from there.
cheers..milton kb
|
|
|
|
|
|
Aljechin wrote:
1. How do I use ShellExecute inside my MFC program to register an activex control, say MyControl.ocx located at D:\MyFolder?
While you can use ShellExecute() or CreateProcess() for this, you could also use LoadLibrary() and GetProcAddress() to call the exported DllRegisterServer() function.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Halo sir,
I went through your article which demonstrates the usage of UpdateResource() . Nice one. But from that I am unable to understand how do I do the same when I have imported it as a Binary resource into my MFC app. Its like I have an activeX DLL imported as a binary resource and it is a part of my executable now. I need to register the control to any machine on which the executable is run. I have understood that I could do it with ShellExecute() But I do not know how to use this resource!! Is copying this data to a file on the machine and registering it the only possible way? Can I not register it from within my program itself without copying this binary and creating a replica of the actual file?
Thanks for your help.
Aljechin.
|
|
|
|
|
Aljechin wrote: Is copying this data to a file on the machine and registering it the only possible way?
It's the only way that I am familar with.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
please any ont tell me how to type cast from CString to int
actually i receive the value from user and the value is int type but
i used its datatype CString now for futhure operation i want to typecast it
to int .
so plz tell me how i convert it.
Please mail me
-- modified at 2:04 Thursday 15th June, 2006
|
|
|
|
|
yogendra kaushik wrote: please any ont tell me how to typa cast from CString to int
i get the CString type value from user now i want to convert it in to int
for any use so plz tell me how i convert it.
here is one way
int i=atoi(str.GetBuffer());<br />
str.ReleaseBuffer();
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Calling GetBuffer and ReleaseBuffer is completely unnecessary. The following will work:
CString FName = "10";
int n = atoi(FName);
It works because CString has an operator LPCTSTR .
Steve
|
|
|
|
|
Stephen Hewitt wrote: Calling GetBuffer and ReleaseBuffer is completely unnecessary
Ohh...
GetBuffer and ReleaseBuffer is mostly used where you want to modify data of the CString instead of Format.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Use _ttoi() function
Amar
|
|
|
|
|
Try this way.
CString strInteger(_T("302"));<br />
int iValue = _ttoi(strInteger);
i value will be 302
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
|
You have recieved several answers to your question and they all show you how to convert a string to integer. Take note that this is not type casting, it is conversion from one form to another. This is important because you could type cast a string to an integer value but the value would not be the value entered in the string. It would take the individule byes and assume they are parts of the final number you are seeking.
char str = "AB"; // 'A' = 0x41, 'B' = 0x42
short n = (short*)(str); // n = 0x4241 = 16961
If you are wondering about the reversal of the numbers durring the type casting, then you need to go look up big endian and little endian on the Web.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi guys !
In windows service code
I have following code in function void CServiceModule::Run()
CDatabase DB;
try
{
if( !DB.IsOpen() )
DB.Open("PrinterDB");
}
catch( CDBException* e )
{
char Buffer[256]="";
AfxMessageBox(e->m_strError);
}
DB.Close();
here PrinterDB is the name of my DSN pointing to an MDB file.
Now when I run it as normal executable it works properly.
but When I run it as service (from MMC start service) connect to DB fails.
Please help me...
|
|
|
|
|
|
this is a security related issue.
what rdbms u r connecting to?
what kind of authentication you used in ur dsn?
cheers..milton kb
|
|
|
|
|
I am connecting to Microsoft MS acess database (mdb file.) . It says
try
{
// My code
}
catch( CDBException* e )
{
::OutputDebugString("CDatabase incorrect");
char Buffer[256]="";
AfxMessageBox(e->m_strError);
}
Error
"Data source name not found and no default driver specified"
|
|
|
|