|
Create function pointers in a header file for all the magnification APIs that you're going to use.
Check the OS version and if Vista or above, call LoadLibrary on Magnification.dll .
After this call GetProcAddress on the function to initialize the function pointer.
So the header file could look like this -
typedef BOOL (*PFN_MAG_INITIALIZE)(void);
From the main program, you could have a call to some function called InitMagnification .
In the InitMagnification function, do the dynamic loading after checking the OS version.
PFN_MAG_INITIALIZE MagInitialize = NULL;
if (osVersion >= "VISTA")
{
HMODULE hmod = LoadLibrary(_T("Magnification.dll"));
MagInitialize = GetProcAddress(hmod, "MagInitialize");
}
In the source where this function is called, do the checking as follows -
if (MagInitialize)
{
MagInitalize();
}
I have omitted error checking, which you have to do.
|
|
|
|
|
Thank you very much. After posting this question, I did exactly what you told me to do. Thank you again
|
|
|
|
|
thanh_bkhn wrote: But we know this library doesn't exist in windows XP. How can I ignore this library when opening the application in windows XP? Sounds like you need to read up on implicit vs. explicit linking.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Thank you. I performed an explicitly link to my DLL.
|
|
|
|
|
As an alternative, you could use delay load dll. In this case you do not need to change the code you have already written (related to statically linking to the library), all you need to do is just do not call chunk of codes related to magnification at all. Saves you a lot of annoying LoadLibrary/GetProcAddress calls.
However, it looks like you have already implemented it. So, just learn about this, so that you could use in future
|
|
|
|
|
Thank you for introducing me this.
I found this way is more interesting than using LoadLibrary, but I still prefer to the old method, because it helps me to compile the program even on Windows XP
|
|
|
|
|
Hi,
I am using DirectShow to play, pause audio / video files. Now I want to implement mute functionality for any audio / video file. Is this possible using DirectShow or I have to use any other method.?
I want to make sound off from a currently playing video file, When user clicks on the sound button, audio should not be heard.
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
So do you want to pause the playing of the audio file, or just mute the speakers (while the audio file continues to play)?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi,
I just want to mute the speakers while audio file continues to play.
Similar to mute functionality, don't want to pause the audio file. it should continue playing while we mute the sound from the speakers.
Regards,
Mbatra
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi,
I have created a property sheet and it contains 3 pages. I want to disable any of the page based on some condition.
Is there any method of disabling pages in a property sheet.?
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
Can't you use the EnableWindow(BOOL) method? Supplying TRUE to enable and FALSE to disable. See here[^]
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi everybody, I want to interface a win32 console application with arduino uno via serial port. Can someone help me ?
Thanks a lot.
|
|
|
|
|
nonness wrote: Can someone help me ? With which part specifically?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
I want to send characters from my c++ code to my arduino through the serial port. In fact, i found a tutorial but it is a CLR console application i added some modifications on my win32 application's properties and when i run it there are 0 errors but the program doesn't work :/
|
|
|
|
|
Did you Google[^] for?
Veni, vidi, vici.
|
|
|
|
|
indeed, but i didn't find a suitable result
|
|
|
|
|
What's exactly the problem? Are you able to write a simple application using the serial port on Windows side? On Arduino one?
Veni, vidi, vici.
|
|
|
|
|
I have a code which turns an arduino's pin on and off. This the code:
C++ script:
#include "stdafx.h"
using namespace System;
using namespace System::IO::Ports;
int main(array<System::String ^> ^args)
{
String^ answer;
String^ portName;
int baudRate=9600;
Console::WriteLine("Type in a port name and hit ENTER");
portName=Console::ReadLine();
SerialPort^ arduino;
arduino = gcnew SerialPort(portName, baudRate);
try
{
arduino->Open();
do
{
Console::WriteLine("Type \"on\" to turn the light on or \"off\" to turn it off");
answer=Console::ReadLine();
if(String::Compare(answer,"on")==0)
arduino->WriteLine("1"); else if(String::Compare(answer,"off")==0)
arduino->WriteLine("0"); else
Console::WriteLine(answer+" was not an option");
Console::WriteLine("Try again? yes/no");
answer=Console::ReadLine();
Console::Clear();
}while(String::Compare(answer,"yes")==0);
arduino->Close();
}
catch (IO::IOException^ e )
{
Console::WriteLine(e->GetType()->Name+": Port is not ready");
}
catch (ArgumentException^ e)
{
Console::WriteLine(e->GetType()->Name+": incorrect port name syntax, must start with COM/com");
}
Console::Write("Press enter to close the program");
Console::Read();
return 0;
}
Arduino sketch:
int ledPin = 13;
int state=0;
void setup() {
pinMode(ledPin, OUTPUT); Serial.begin(9600); }
void loop() {
if (Serial.available() > 0)
{
state = Serial.read();
switch(state) {
case '1': digitalWrite(ledPin,HIGH);
break;
case '0': digitalWrite(ledPin,LOW);
break;
default:
break;
}
}
}
Now when i modify the code : when i send a word to the arduino it must return the ascii code of the first letter and the words are : Left Right Forward Back. So, i wrote:
#include "stdafx.h"
using namespace System;
using namespace System::IO::Ports;
int main()
{
String^ answer;
String^ portName;
int baudRate=9600;
Console::WriteLine("Type in a port name and hit ENTER");
portName=Console::ReadLine();
SerialPort^ arduino;
arduino = gcnew SerialPort(portName, baudRate);
try
{
arduino->Open();
do
{
Console::WriteLine("Type \"on\" to turn the light on or \"off\" to turn it off");
answer=Console::ReadLine();
if (((350<=x)&&(x<=550))&&((200<=y)&&(y<=300)) )
{
cout << "Left" ;
arduino->WriteLine("76");
cout << "\n" ;
}
if (((100<=x)&&(x<=250))&&((200<=y)&&(y<=300))){
cout << "Right" ;
arduino->WriteLine("82");
cout << "\n" ;
}if (((300<=x)&&(x<=350))&&((300<=y)&&(y<=400))){
cout << "Back";
arduino->WriteLine("66");
cout << "\n" ;
}
if (((300<=x)&&(x<=350))&&((80<=y)&&(y<=200))){
cout << "Froward" ;
arduino->WriteLine("70");
cout << "\n" ;
}
Console::WriteLine("Try again? yes/no");
answer=Console::ReadLine();
Console::Clear();
}while(String::Compare(answer,"yes")==0);
arduino->Close();
}
catch (IO::IOException^ e )
{
Console::WriteLine(e->GetType()->Name+": Port is not ready");
}
catch (ArgumentException^ e)
{
Console::WriteLine(e->GetType()->Name+": incorrect port name syntax, must start with COM/com");
}
Console::Write("Press enter to close the program");
Console::Read();
}
|
|
|
|
|
While it may not be related to the problem you are having, you might want to consider the Managed C++ forum.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
|
Hi, I have implement a D-Flipflop in C++, I.e. 'D' as a input and 'Q' as a output with 'clk' as a conrol input.
When clk = '1' and D = '1/0' then Q = D;
How to realize clock in C++. It should be of 50% duty cycle using the system frequency. is there any function to use the system clock in program.
|
|
|
|
|
|
I don't need a timing info from the system. It should provide the the system clock as a input to my program.
How to clock in C++/C for the function of digital blocks.
|
|
|
|