|
Kushagra Tiwari wrote: Is there a way to know specifically which one of the two has been initiated ??
That has been asked before, but I do not recall the answer. Have you looked at the lParam parameter?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
I want to load a pdf file on the click of a button.
In the OnClickButton() implementation I am writing the function which open the PDF file
ShellExecute(0,
"Open",
"%s\\HELP\\RiverCADPro_User_Manual.pdf",
NULL,
NULL,
SW_MAXIMIZE);
The above code is not working.What else is to be needed so as to run the above code
|
|
|
|
|
deadlyabbas wrote: "%s\\HELP\\RiverCADPro_User_Manual.pdf"
What is this "%s" on the start of the file path???
I've tested the form below and it works fine:
ShellExecute(NULL,
_T("Open"),
_T("D:\\Test.pdf"),
NULL,
NULL,
SW_MAXIMIZE);
Nuri Ismail
|
|
|
|
|
Thank You!!
Actually its a help file which I want to open on the click of help button.
Can you please tell me that how we are going to open the related bookmark.
|
|
|
|
|
Now i will give you an example code which works with Acrobat Reader. But you have to get the path to Acrobat Reader yourself and also form the command line parameters for your need. You can find information about the cmd line parameters of Acrobat Reader here[^].
Here is the example for you:
const CString strAcroPath = _T("C:\\Program Files\\Adobe\\Reader 9.0\\Reader\\AcroRd32.exe");
const CString strParameters = _T(" /A \"page=5&zoom=200&pagemode=bookmarks\" ");
const CString strFilePath = _T(" \"D:\\Test.pdf\" ");
const CString strCmdLine = strParameters + strFilePath;
ShellExecute(NULL,
_T("Open"),
strAcroPath,
strCmdLine,
NULL,
SW_MAXIMIZE);
The code above will work only on systems with Adobe Acrobat Reader installed!!!
If you want to support other readers you have to find information whether they support cmd line parameters and if yes then what is the exact syntax.
I hope this helps!
Nuri Ismail
|
|
|
|
|
deadlyabbas wrote: The above code is not working.
What does it mean, exactly?
Do you know ShellExecute has a return value?
deadlyabbas wrote: "%s\\HELP\\RiverCADPro_User_Manual.pdf",
deadlyabbas wrote: What else is to be needed so as to run the above code
See documentation [^] for the requirements (of course you need also PDF reader application).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
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++
|
|
|
|
|
deadlyabbas wrote: Actually I want to get the registry path where the .exe of Acrobat reader is.
FindExecutable() should do what you require.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
deadlyabbas wrote: ShellExecute(0,
"Open",
"%s\\HELP\\RiverCADPro_User_Manual.pdf",
NULL,
NULL,
SW_MAXIMIZE
question remain, do you want to load that in Adobe reader or in your application itself
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Please the questin attached to your reply ............
Yes I want to load the PDF and want to show the bookmarks also
|
|
|
|
|
Here is my code:
vector<int> CPanoCylinderImage::RGBofPixel(CImage image, int x, int y)
{
vector<int> vect;
COLORREF cr = image.GetPixel(x, y);
BYTE r = GetRValue(cr);
BYTE g = GetGValue(cr);
BYTE b = GetBValue(cr);
vect.push_back((int)r);
vect.push_back((int)g);
vect.push_back((int)b);
return vect;
}
float CPanoCylinderImage::IntensityOfPixel(CImage image, int x, int y)
{
vector<int> vect = RGBofPixel(image, x, y);
return 0.30f * vect.at(0) + 0.59f * vect.at(1) + 0.11f * vect.at(2);
}
float CPanoCylinderImage::LuminanceDifference(CImage image1, CImage image2, int length)
{
float diff = 0.0;
float sum = 0.0;
float intensity = 0.0;
vector<float> vectImage1, vectImage2;
for(int i = 0; i < image1.GetHeight(); i++)
{
for(int j = image1.GetWidth() - length; j < image1.GetWidth(); j++)
{
intensity = IntensityOfPixel(image1, j, i);
vectImage1.push_back(intensity);
}
}
return ;
}
image1 and image2 have been loaded correctly.When I calculate intensity first time, I got the right RGB value and intensity value. But second time, I got Debug Assertion Failed when it run statement "COLORREF cr = image.GetPixel(x, y);", messagebox told me that
File: ...........\atlimage.h
Line: 1217
Expression: hBitmap == m_hBitmap
Anybody know what's happening?
modified on Thursday, September 17, 2009 4:03 AM
|
|
|
|
|
Why don't you pass the CImage object by reference?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank u! U solved this problem. Can you tell me why I failed?
|
|
|
|
|
Well, I don't know, exactly. Anyway using a copy of the image object is wrong, you need to use the actual instance.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi All,
MFC(VC++)
I have a shared folder in server, client will access that folder through a dilaog box.
I have to give username, password of server in the program.
Please help me.
Thanks
Ranjith
|
|
|
|
|
Have a look at this [^] CP article.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks pallini for reply.
I read that artical but it will work only for local system, but I have to connect to onother(server) macine through WAN.
Ranjith
|
|
|
|
|
Use NetUseAdd() for this.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Thank you,
NetuseAdd() function need to link with netapi32.lib but I am unable to download that files.
I am using windowsXP as client and windows 2003 server as server.
ranjith
|
|
|
|
|
ranjithgoud wrote: NetuseAdd() function need to link with netapi32.lib but I am unable to download that files.
You don't need to download anything. That file is already in your Visual Studio folder.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
CImage imageOriginal;<br />
imageOriginal.Load(_T( "read.tif" ));<br />
<br />
<br />
CRect rectCopy(9177,68, 10566, 635);<br />
<br />
CImage imageNew;<br />
imageNew.Create(rectCopy.Width(), rectCopy.Height(), imageOriginal.GetBPP());<br />
imageOriginal.BitBlt(imageNew.GetDC(), rectCopy, rectCopy.TopLeft());<br />
imageNew.Save(_T("D://imgnew.jpg"));<br />
<br />
imageNew.ReleaseDC();
when i pass the 9177, 68 ,10566,635 these rectangular portion ..the output of image contains only black.
the whole area of images are black ...how to pass these rectagular portion ..??
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
rajugis wrote: imageOriginal.BitBlt(imageNew.GetDC(), rectCopy, rectCopy.TopLeft());
That's wrong. you should use, for instance:
CRect rect(rectCopy);
rect.OffsetRect(-rectCopy.left, -rectCopy.top);
imageOriginal.BitBlt(imageNew.GetDC(), rect, rectCopy.TopLeft());
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thank for your replay
CImage imageOriginal;
imageOriginal.Load(_T( "read.tif" ));
CRect rectCopy(9177,68, 10566, 635);
CImage imageNew;
imageNew.Create(rectCopy.Width(), rectCopy.Height(), imageOriginal.GetBPP());
CRect rect(rectCopy);
rect.OffsetRect(-rectCopy.left, -rectCopy.top);
imageOriginal.BitBlt(imageNew.GetDC(), rect, rectCopy.TopLeft());
imageNew.ReleaseDC();
imageNew.Save(_T("D://imgnew.jpg"));
still its showing the whole area of image is black
???
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
See this[^] answer to your question.
|
|
|
|
|
Why don't you start with 'fail-proof' parameters?
For instance you may start copying from the origin (top-left) of the source image.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|