|
How is it going?
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Hello,
I am trying launching an application telling it to open a document. I build a command line surrounding the program name and each document with quotes and then use ShellExec to process. This works fine with all applications except old Adobe programs (like PhotoDeluxe or Photoshop LE). So I tried CreateProcess instead it does not work either. Tried ShellExecuteEx same error: the program does not find the document. If I take the command line I am builing and paste it in a Command Prompt it works. Other programs are able to run the application passing it a file to open.
So my question is: what other way can I use to run that application telling it to open an application... Should I revert to _exec or is there something else?
Regards,
Nicolas
|
|
|
|
|
What does the code snippet look like that tries to launch Adobe and its command-line arguments?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Something like this:
string fnames;<br />
list<string> sel = GetSelection();<br />
for (list<string>::iterator it = sel.begin(); it != sel.end(); ++it)<br />
fnames += "\"" + *it + "\" ";<br />
<br />
strEditor = "\"" + strEditor + "\"";<br />
strDir= "\"" + strDir+ "\"";<br />
<br />
ShellExecute(NULL, "open", strEditor.c_str(), fnames.c_str(), strDir.c_str());
This works with latest version of Photoshop for instance (6 and later) and Paint Shop Pro but NOT with Photoshop LE 5 and Photoshop Deluxe. CreateProcess and ShellExecuteEx fail the same way: the app is correctly launched but it can't find the files I am passing.
Regards,
Nicolas
|
|
|
|
|
Have you tried calling ShellExecute() with string constants instead of variables? This will tell you if the variables are incorrect.
ShellExecute(NULL, "open", "c:\\program files\\adobe.exe", "file1 c:\\somepath\\file2 file3", "c:\\somedir", ...);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
David,
thanks for suggesting. The problem came from the trailing whitespace at the end of fnames. I removed it and it workls!
Thanks again,
Nicolas
|
|
|
|
|
|
Hi,
I have a COM server, and a private class for the internal use of the COM object, what I want to do is to add a a method that returns a CComObject<> * Object, I have two problems:
If I make this:
<br />
CComObject<Connections> *DBGroup::GetGroupConnections(_bstr_t strGroup)<br />
{<br />
CComObject<CConnections>* pConnections; <br />
HRESULT hr = CComObject<CConnections>::CreateInstance(&pConnections);<br />
<br />
(...)<br />
return pConnections; <br />
}<br />
1. I get a compiler error telling me that he don't knows about the Connections com component that I have created in the same server.
2. If Instead of that I return and IConnection interface, Do I generate there a leakage ? ( I don't call the "delete pConnection"), what is the solution or workaround for this problem ?
Thanks in advance, greetings
Braulio
|
|
|
|
|
1.Initialize your object
CComObject<CYourBaseClass>* pConnection;
...
pConnection->AddRef();
return pConnections;
2.Returning a pointer cuases very much a memory leak UNLESS you destroy it in your caller function
CComObject<CYourBaseClass> *pConnection = GetGroupConnections(...);
pConnection->...
pConnection->Release();
Peter Molnar
|
|
|
|
|
So, I can do directly ?
<br />
CComObject<CYourBaseClass>* pConnection;<br />
<br />
pConnection->AddRef();<br />
<br />
return pConnections; <br />
And I don't have to call "CreateInstance" ?
If I want to return my object as an interface( e.g. a list of users that matches a certain criteria), so the collection will not be hold as a member variable, can I use ?
<br />
get_Connection(IConnection **pVal)<br />
{<br />
CComObject<CYourBaseClass>* pConnection;<br />
<br />
pConnection->AddRef();<br />
<br />
return pConnections->QueryInterface(...)<br />
}<br />
And then in the client code retrieve that value with an smart pointer ?
<br />
IConnectionPtr pConn = pMyComObject->Connection;<br />
So with the smart pointer, the object will be released automatically ?
Thanks in advance, greetings
Braulio
|
|
|
|
|
You have very much to call CreateInstance, which I ment to indicate with ... (dots) in my code. Since it was OK in yours, I didn' repeated it again, modify your get_Connection function accordingly. AddRef tells the object that there will be one more call on it, it should not unload itself, and Release tells that the call have already taken place, it can unload.
So after you received the interface pointer,you should release it. Smart pointers indeed eliminate this, because they call AddRef on object creation and Release on when the object goes out of scope.
Peter Molnar
|
|
|
|
|
Hi all,
i have a problem using the system or _exec functions when i try to load an external executable file from my code:
if i use:
system("C://myfolder//converter.exe JONNY.FFT BAGONKY.TXT");
my converter work fine and i find my output file in the "Debug" folder of my project.
if i use:
system("C://Documents and settings//converter.exe JONNY.FFT BAGONKY.TXT");
i don't find anything!!!!
How can i resolve this problem?
|
|
|
|
|
|
dukeleto wrote: my converter work fine and i find my output file in the "Debug" folder of my project.
Which indicates that the current working directory (CWD) is being used.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Dear all,
Can I trap when Windows TaskManager kill me?
Best Regards,
kglau
|
|
|
|
|
On older Windows operating systems, the TaskManager first attempts to send a WM_DESTROY message to the thread's main window, and if it fails, it will attempt to terminate the thread itself. This can be trapped by utilizing simple thread-messaging maps. See MSDN for information about threads and thread messages.
On newer operating systems (2000 and above), the TaskManager will always kill the virtual machine that is running the process that is hang. Hooking this would require some extensive API knowledge and a system wide-hook for trapping low-level kernel operations.
However, I wouldn't suggest that you even attempt to hook the operation, as the TaskManager's process-killing feature is supposed to exist and work properly on every Windows platform to end processes that are hung, acting incorrectly or are not desired.
Overriding the default behaviour would quickly result in users having malicious processes like viruses, torjans or advertising/spying software that cannot be killed without using Safe mode and delicate deletion methods. Find some other way to accomplish whatever it is you are trying to do.
If you are attempting to write a virus/trojan or advertising/spying software, then this is a wrong place to ask. We are coders of honor and respect for our jobs. Our software is made to be enjoyable and useful, not to harass people or hinder users.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi,
Of course I am not writing a virus/trojan, because writing program is my job, I am also respect
for my job too.
Thanks anyway..
KG
|
|
|
|
|
I have visual studio.net and making a database project with access. But some query runs under access and visual studio.net but same have problem under visual studio.net
and successfully runs under access. I am conneting using ODBC: Microsoft Access driver.
|
|
|
|
|
Is it because your ODBC doesn't support some SQL version?
(in MSDN)
The following SQL-92 features are not supported by Microsoft Jet SQL(the one Access ODBC was using usually):
Security statements, such as GRANT and LOCK.
DISTINCT with aggregate function references.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi,
Iam trying to incorporate the kodak image edit activex control in my vc++ dialog based application...can anyone help me out in how to use this control ....
Any help would be highly appreciated.
Thanking you
Satadru
|
|
|
|
|
Hi,
My application should do something like this. When I click a menu item, a dialog is displayed and after entering values and clicking OK, the entered values are displayed in the view. I have done so far.
Now after invoking the dialog, filling the values and clicking OK, I need these values to be displayed in a new frame. How do I go about doing this?
With regards
|
|
|
|
|
try this;
add code in onOK()
{
CNewFrame nf;
nf.m_XXX = yourValue;
nf.domodel();
}
Happy Gemini
|
|
|
|
|
This would mean, CNewFrame is a Dialog. I want to have a frame. Is this possible
|
|
|
|
|
I assume here that you have a SDI application, which consists of a frame window with menu and one view.
When you dismiss the dialog, you can get the necessary data values either by accessing them directly using GetDlgItem or by using the DDX system. Now, if you wish to create a new frame window, then you need to derive two new classes: one from CFrameWnd and one from CView. The frame window is created, and when created, it creates one view for itself.
After this, you can write your stuff into the view by using TextOut functions as necessary.
If you are developing an MDI application, you only need to derive a class from CMDIChild. Then create a new child window, specify the MDI frame window as parent, and use TextOut functions to output text into the child window.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I am using an MDI application. But how do I specify the MDI Frame Window as parent. I am not very clear on this part.
Do get back..
WIth regards
|
|
|
|