|
I dont think an Example is needed here. Just go through MSDN and see what all these parameters are doing. You will get to see the sample values of these parameters as well. However, if you are getting error in a specific argument, then tell us.
And if you are confused how to call an API from VC, its simple . Just call it as a normal function.
Think Negatively, It makes you creative
|
|
|
|
|
What about:
DWORD dwSize = 0,
dwCount;
LPPRINTER_INFO_1 lpPrinterInfo1 = NULL;
EnumPrinters(PRINTER_ENUM_NETWORK, NULL, 1, (LPBYTE) lpPrinterInfo1, dwSize, &dwSize, &dwCount);
lpPrinterInfo1 = new PRINTER_INFO_1[dwSize];
EnumPrinters(PRINTER_ENUM_NETWORK, NULL, 1, (LPBYTE) lpPrinterInfo1, dwSize, &dwSize, &dwCount);
for (DWORD dwIndex = 0; dwIndex < dwCount; dwIndex++)
TRACE("]%s[\n", lpPrinterInfo1[dwIndex].pName);
delete [] lpPrinterInfo1;
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi all,
I want to call a CDAODatabase class from my Regular MFC DLL, I have followed the instruction of Microsoft MSDN. But the following code incorrect run.
Can you help me on it ?
Thanks a lot for your reply.
Tuan
PS : This is my code
extern "C" BOOL PASCAL EXPORT VehicleChange()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CDaoDatabase* connData;
try{
connData = new CDaoDatabase ;
if(connData->IsOpen()) {
AfxMessageBox("The connection has been openned");
}else{
CString strConnect= "ODBC;DSN=FieldTrip;UID=;PWD=;";
connData->Open(_T(""), TRUE,FALSE, strConnect);
}
strSql = "update VehicleInformation set cAacity=11";
connData->Execute(strSql,dbSQLPassThrough);
} catch(CException *e){
connData->Close();
delete connData;
AfxDaoTerm();
return false;
}
AfxMessageBox("success");
connData->Close();
delete connData;
AfxDaoTerm();
return true;
}
|
|
|
|
|
Hello Friends,
What is the advantage of having virtual Destructors?
Bye take care
Neelesh K J Jain.
|
|
|
|
|
We ask this on our face to face interview.
What does a virtual function do? It allows the proper method to be invoked from an related class pointer.
When does a destructor get called? It gets called when the object is destroyed.
Thus what does a virtual destructor do? It allows for the proper destruction of an object given a related pointer.
class A
{
public:
virtual ~A {}
};
class B : public A
{
public:
B ()
{
m_p = new char [50];
}
virtual ~B ()
{
delete m_p;
}
char *m_p;
}
void main ()
{
A *p = new B;
delete p;
}
If the destructor wasn't virtual (A and B), then the code would leak m_p because only A's destructor would be called. When they are virtual, the proper destructor is invoked.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim,
I was going to mention the same thing. I have given a lot of interviews and this question is a most probable one.
Think Negatively, It makes you creative
|
|
|
|
|
for example, you have different objects derived from the same base class, you want to add instances of each of them in a list ( STL ), and your list is of the base class type; when deleting object on the list, you can delete them and the virtual destructor of each derived classes will be called.
( or something to that effect )
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I have two questions. First off, is there some control or typical method for displaying hypertext in a visual c++ dialog based program. IE I want blue text with a url behind it that pops up the web browser when the user clicks on it.
Second, is there a way to call a method that does the click without the user having to click on the text. IE If they select a menu item labelled "visit online instructions", what would be the code to call the web browser and automatically link to www.someinstructions.com?
Thank you!
-----------------
http://www.zachcalvert.com
|
|
|
|
|
|
I want to know whether my program can obtain the message that system time is changed
|
|
|
|
|
Yes is can.
*cough*
WM_TIMECHANGE
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
I am a macintosh programmer. I have many years of experience with C/C++. I need to port a plugin from the mac to the PC. I have an application that allows the user to design a custom dialog. This is not a general purpose dialog editor. When the user if finished, the application generates the resources for defining the dialog and combines that with the plugin code. The application is already running on windows. So what I need to do now is port the plugin to windows. It seems that a dll would be the right thing. So my first question is what should I use to write the plugin/dll (MFC, ATL, ??). The second is how do I embed the resources in the dll. If I can create all the dialog items programmatically then I could create my one data for describing the dialog items. If there is documentation for how to embed the resource and what the format is for each dialog item type then that would be acceptable as that is what I'm doing on the mac side now. I also need to embed some custom binary data. Not knowing windows programming I'm concerned that I might start down a path that will lead to a dead end.
|
|
|
|
|
what is this and how can i use it
Int 21h Function 440Dh Minor Code 41h (FAT32)
Writes data from a buffer to a track on the specified device.
mov bx, Drive ;See below
mov ch, DeviceCat ;See below
mov cl, 41h ;Write Track on Logical Drive
mov dx, seg WriteBlock ;See below
mov ds, dx
mov dx, offset WriteBlock ;ds:dx points to RWBLOCK structure
mov ax, 440Dh ;IOCTL for block device
int 21h
jc error_handler ;carry set means error
|
|
|
|
|
while programming dos, we have to program interrupts. These interrupts are like 10h, 13h, 21h etc, each made for a pre-specified purpose.
21h is called a DOS interrupt. This is a general-purpose interrupt. I guess I can't tell you the whole thing here or perhaps you will not be able to catch up with these things. You need to learn a little bit of System Programming in DOS and Assembly to exactly grab these.
Well, any way, I should continue. Every interrupt is/can be called with a major and minor code. This is like passing arguments to a function. And every major and minor code is for something specific. In this case, I guess major code of 440DH is telling DOS to communicate with the Disk and Minor Code must also be something specific. Now, you will have to check yourself what these codes do and how are these being handled in the next assembly statements.
Think Negatively, It makes you creative
|
|
|
|
|
What I am trying to make is a Sidekick translator.
As soon as a user launches it, it minimizes to taskbar.
When mouse is hovering on top of a word, it should pop up a tip-window with its corresponding explanation found in the database.
I've successfully hooked up Notepad.exe and had the following API functions replaced:
TextOutA, ExtTextOut, DrawTextA, DrawTextEx.
But none of them seems to be what Notepad uses to display text.
Could someone be of help?
Thanks a lot.
|
|
|
|
|
Notepad is actually a standard, multi-line editbox...
mrviceroy wrote:
I've successfully hooked up Notepad.exe and had the following API functions replaced:
TextOutA, ExtTextOut, DrawTextA, DrawTextEx
How?!
Bikram Singh
|
|
|
|
|
bikram singh wrote:
How?!
Search for API hooks here at CP (or just hooks i'm not sure)
There is an article that explains all sorts of hooking techniques.
How do I print my voice mail?
|
|
|
|
|
Visual C++ Developer's journal had an article on how to do this,
it was published by Fawcette pub, you should still be able to find it.
-Steven Hicks
CPACodeProjectAddict
|
|
|
|
|
Could you give me the time or url, please?
Thank you.
|
|
|
|
|
|
|
Hi All,
I have one application running on Windows 2000 server.
It's multithreaded app usingg lot of synchronization objects,STL library , and LDAP stuff. It's crashing after sometime when I enable hyperthreading.
I'm not able to find the reason of actual crash.
Is anyone aware of this issue ?
thanks
Ben
|
|
|
|
|
maybe you have some receconditions, and with HT enabled, they occur faster. you must test a multithreaded app on a multi-CPU computer.
|
|
|
|
|
I did test on multiprocessor system(Intel Xeon) and same issue. Hyperthreading is actually virtual two processor.
Is there any tool to check the race condtitions ?
|
|
|
|