Click here to Skip to main content
15,879,077 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Stopping windows shutdown in C++./MFC? Pin
Kushagra Tiwari17-Sep-09 20:24
Kushagra Tiwari17-Sep-09 20:24 
QuestionRe: Stopping windows shutdown in C++./MFC? Pin
David Crow18-Sep-09 4:18
David Crow18-Sep-09 4:18 
QuestionHow to load PDF file on any button click in VC++? Pin
deadlyabbas16-Sep-09 22:32
deadlyabbas16-Sep-09 22:32 
AnswerRe: How to load PDF file on any button click in VC++? Pin
Nuri Ismail16-Sep-09 22:46
Nuri Ismail16-Sep-09 22:46 
GeneralRe: How to load PDF file on any button click in VC++? Pin
deadlyabbas16-Sep-09 23:12
deadlyabbas16-Sep-09 23:12 
GeneralRe: How to load PDF file on any button click in VC++? Pin
Nuri Ismail17-Sep-09 0:50
Nuri Ismail17-Sep-09 0:50 
AnswerRe: How to load PDF file on any button click in VC++? Pin
CPallini16-Sep-09 22:51
mveCPallini16-Sep-09 22:51 
GeneralRe: How to load PDF file on any button click in VC++? Pin
deadlyabbas16-Sep-09 23:36
deadlyabbas16-Sep-09 23:36 
Thanks Once again.
Actually I want to get the registry path where the .exe of Acrobat reader is.
So that I can pass the command line arguments to it ...........
Because to open a PDF with sppecific book mark I need the exe path and by command line argument I will pass the page number to it.
Like wise we do in Delphi

HelpFilePath : String;
DoesFileexists : Boolean;
CommandLine : String;
ExePath : String;
IsAcroExeLocated : Integer;
ButtonSelected : Boolean;
AcroVersion : String;
//Extracting Acrobat executable file path from Registry
// replace the double quotes and %1 from the string
ExePath := AnsiReplaceStr(GetRegistryValue('\AcroExch.Document\Shell\Open\Command'),'"','');
ExePath := AnsiReplaceStr(ExePath,'%1','');
// creating the help file path from WaterNET.exe path and file name
helpfilepath := extractfilepath(application.exename) + 'help\WaterNET_user_manual.pdf';
DoesFileexists := False;
DoesFileexists := Fileexists(ExePath);

if DoesFileexists then
begin
{ Display Alert message that Adobe Reader 5.0 Required }
//GetVersion finds the version information using the file properties

AcroVersion := GetVersion(ExePath);
if StrToIntDef(AcroVersion,0) < 6 then
begin
MessageBox(Application.Handle,
pchar(#13 + 'Adobe Acrobat PDF Reader version6.0 (or newer) is required.'),
pchar('Adobe Reader Version'),
mb_OK + mb_ICONWARNING + MB_APPLMODAL);
exit;

end; //if StrToIntDef(AcroVersion,0)

// Checking that specified file is existing
if Not FileExists(HelpFilePath) then
begin
MessageDlg(MSG_HELP_FILE_NOT_EXIST, mtWarning, [mbOK], 0);
Exit;

end;

// set command line parameters based from where the help file is opened
case BookmarkConstant of

WNET_HELP_USER_MANNUAL :
// when user clicks on help->user mannual
begin
// '/s' used for silently opening the acrobat reader instead of the splash screen
CommandLine := ('/s /n /A page=1 "'+ helpfilepath +'"');

end;

help_WaterNET :
// when user clicks help-> WaterNET Help or press F1
begin
// '/n' used for openning the file in same opened acrobat reader
CommandLine := ('/s /n /A zoom="100"&page=1&pagemode=bookmarks "'+ helpfilepath +'"');

end;
else
// when user click help button on a dialog
begin
// using '/A' all the parameters consider as a string
CommandLine := ('/s /n /A page='+ inttostr(BookmarkConstant) + '&View=FitBV "'+ helpfilepath +'"');

end;

end;

IsAcroExeLocated := 0;
//executing the Acrobat.exe with command line parameters

IsAcroExeLocated := ShellExecute(0, {Forms handle}
'open', {Operation}
PAnsiChar(ExePath), {EXE name with path}
PAnsiChar(CommandLine), {Commandline parameters}
nil, {Working directory}
SW_SHOWMAXIMIZED); {show
state}


end;

// checking if Acrobat reader is not available then go for download the Acrobat
if not (DoesFileexists) or (IsAcroExeLocated < 32) then
begin
buttonSelected := MessageBox(Application.Handle,
pchar(#13 + 'No Adobe Acrobat PDF Reader found. Press OK to download Adobe Acrobat Reader or press Cancel to abort.'),
pchar('Adobe Reader Required'),
mb_OKCANCEL + mb_ICONWARNING + MB_APPLMODAL) = IDOK;

// checking if OK button is pressed then open the link for download the Acrobat
if buttonSelected then
begin
ShellExecute(0, {Forms handle}
'open', {Operation}
PAnsiChar('http://get.adobe.com/reader/'), {EXE path}
nil, {Commandline parameters}
nil, {Working directory}
SW_SHOWMAXIMIZED); {show state}
end;

end;


But I want to do all in VC++
AnswerRe: How to load PDF file on any button click in VC++? Pin
David Crow17-Sep-09 2:25
David Crow17-Sep-09 2:25 
AnswerRe: How to load PDF file on any button click in VC++? Pin
ThatsAlok16-Sep-09 23:49
ThatsAlok16-Sep-09 23:49 
GeneralRe: How to load PDF file on any button click in VC++? Pin
deadlyabbas17-Sep-09 0:04
deadlyabbas17-Sep-09 0:04 
QuestionAbout Class CImage::GetPixel [modified] Pin
zhong_min16-Sep-09 21:54
zhong_min16-Sep-09 21:54 
AnswerRe: About Class CImage::GetPixel Pin
CPallini16-Sep-09 22:18
mveCPallini16-Sep-09 22:18 
GeneralRe: About Class CImage::GetPixel Pin
zhong_min16-Sep-09 22:44
zhong_min16-Sep-09 22:44 
GeneralRe: About Class CImage::GetPixel Pin
CPallini16-Sep-09 23:32
mveCPallini16-Sep-09 23:32 
QuestionAccess a shared folder form server to client by giving usename ,password in program Pin
ranjithgoud16-Sep-09 21:21
ranjithgoud16-Sep-09 21:21 
AnswerRe: Access a shared folder form server to client by giving usename ,password in program Pin
CPallini16-Sep-09 21:53
mveCPallini16-Sep-09 21:53 
GeneralRe: Access a shared folder form server to client by giving usename ,password in program Pin
ranjithgoud17-Sep-09 1:49
ranjithgoud17-Sep-09 1:49 
AnswerRe: Access a shared folder form server to client by giving usename ,password in program Pin
David Crow17-Sep-09 2:30
David Crow17-Sep-09 2:30 
GeneralRe: Access a shared folder form server to client by giving usename ,password in program Pin
ranjithgoud18-Sep-09 2:44
ranjithgoud18-Sep-09 2:44 
AnswerRe: Access a shared folder form server to client by giving usename ,password in program Pin
David Crow18-Sep-09 4:15
David Crow18-Sep-09 4:15 
Questionbitblt prob Pin
Game-point16-Sep-09 21:14
Game-point16-Sep-09 21:14 
AnswerRe: bitblt prob Pin
CPallini16-Sep-09 21:46
mveCPallini16-Sep-09 21:46 
GeneralRe: bitblt prob Pin
Game-point16-Sep-09 22:04
Game-point16-Sep-09 22:04 
GeneralRe: bitblt prob Pin
Nuri Ismail16-Sep-09 22:11
Nuri Ismail16-Sep-09 22:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.