|
I'm trying to figure out how to use a file passed or used to start my application when started by a file association through either double-clicking a data file or launched from an attachment from an email. The command line passes the pathname of the file that opened the app, however since the data file is locked I can not access the data through normal file opserations. Somehow the dataptr or filehandle is being passed or managed somewhere. Can someone explain how I can get access to that handle so I can read the data file?
In paticular I want to have access to the data from an email attachment. This means that the email app or some OS mech has launched my associated app and has the file locked.
|
|
|
|
|
I am not sure I understand your question but anything might help you.
1st try rebooting your machine. If you were debugging, windows might not be able to kill the process.
If you are looking at how to, launch your app when your file type is double clicked then you need to write to the registry on your setup script.
here is a page about registry and associating files
http://members.tripod.com/mr_tweaks/mytweaks/reg23.htm[^]
Later, JoeSox www.joeswammi.com
Load my Sig here.....
|
|
|
|
|
Dr Soong wrote:
The command line passes the pathname of the file that opened the app, however since the data file is locked I can not access the data through normal file opserations
Surely you can open it read-only with read-sharing enabled? Else it would be, as you have recognized yourself, be an utterly useless mechanism. Since a multitude of programs apparently are able to do what you request, I must assume you have done something wrong. Play with the sharing flags and I'm sure you'll get something working.
Always request the least privilege you need to get the job done - this goes for everything, not just file sharing and the occasional write access.
|
|
|
|
|
I have a visual c++ program (using mfc) and I want to get the DNS of the computer where the program runs. The operating system is Windows 98. an you advise me how to get it?
|
|
|
|
|
you could use GetNetworkParams check the MSDN for more info.
|
|
|
|
|
I have a Windows Service application with 4-5 dialog boxes in it. I have good reasons to believe that it should have them, but the service would not start unless I remove them.
Anybody any ideas ?
<marquee>. . . Humans do it better . . .
|
|
|
|
|
If your running under the 'system' account you need to have "Allow service to interact with desktop" checked. This is in the Server Properties dialog that you must get to from the 'Services' control panel.
"No matter where you go, there your are..." - Buckaoo Banzi
<pete/>
|
|
|
|
|
Yes that is check'd but is there any restrictions on the size of the UI resources that can be put in a Service (that is causing me problems) ?
or
Is there any limit on the size of the service exe image loaded ?
Tnx palbano
<marquee>. . . Humans do it better . . .
|
|
|
|
|
Prabhakar wrote:
I have a Windows Service application with 4-5 dialog boxes in it. I have good reasons to believe that it should have them, but the service would not start unless I remove them.
Thumb rule: Services should not have windows or consoles that provide feedback to the user.
If the service must have a user interface, it must run under the LocalSystem account.
Any information from EventLog when you have those dialog boxes?
Follow live World Cup Cricket scores here[^]
|
|
|
|
|
Read this:
MSDN[^]
lpDesktop
Windows NT/2000/XP: Pointer to a null-terminated string that specifies either the name of the desktop, or the name of both the desktop and window station for this process. A backslash in the string indicates that the string includes both the desktop and window station names.
For CreateProcess and CreateProcessAsUser, if this member is NULL, the new process inherits the desktop and window station of its parent process. If this member is an empty string, the process does not inherit the desktop and window station of its parent process; instead, the system determines if a new desktop and window station need to be created. If the impersonated user already has a desktop, the system uses the existing desktop.
For CreateProcessWithLogonW, if this member is NULL or an empty string, the new process inherits the desktop and window station of its parent process. CreateProcessWithLogonW adds permission for the specified user account to the inherited window station and desktop. Otherwise, if this member specifies a desktop, it is the responsibility of the application to add permission for the specified user account to the specified window station and desktop.
Follow live World Cup Cricket scores here[^]
|
|
|
|
|
How do you include .NET references in C++ within VS .NET? I want to use the MailMessage object. In C# you just have to specify the following at the top of your file.
using System.Web.Mail
What is the C++ equivalent?
Thanks.
Ron Ward
|
|
|
|
|
Hie
I would like to know how to detect in realtime when another process write into a specific file. This time i try to use completion methode. A little bit like visual when we modify a opened source file by another application. Visual display a dialogBox with the question (Would you want to reload the file ?). But Visual use this juste with focus gain, and me i want to do it in real time.
I create a file sharing and use overlapped option
I try to read into the file and i use the getOverlappedResult function with bWait at TRUE to wait the reading.
I write with another process into this file
But my app still lock ever.
If somone know how to do it ?
thx
|
|
|
|
|
|
zebiloute wrote:
I would like to know how to detect in realtime when another process write into a specific file
The only way to do this is by developing your own "file system filter driver". Check Microsoft's site.
|
|
|
|
|
This one's weird. I'm trying to compile some code that uses a third-party SDK, and I was getting lots of strange compile errors - classes not found, #endif's not found, etc - until I changed the linefeeds in the header files from Unix-style to DOS-style. Now everything compiles.
This is not an adequate fix because we may use future versions of this SDK, and I don't want to have to force our engineers to tweak these files every time a new version of the SDK is instaled. Does anyone know a way around this?
Thanks
|
|
|
|
|
i had to write a program to fix this for some source i was using...
#include < stdio.h >
int main(int argc, char* argv[])
{
while (!feof(stdin))
{
fputc(getc(stdin), stdout);
}
return 0;
}
-c
WWT2D?
|
|
|
|
|
Hi All,
I have had success using the new Symbol Server with WinDbg to view system symbols while debugging. How can I setup VC6 to also use the correct system symbols automatically?
D.C.R.
|
|
|
|
|
I have a subclassed edit control on a propertypage, which is a page in a propertysheet. I want to get all keystrokes in that edit control's PreTranslateMessage including Tab, Ctrl+Tab, Esc, Enter etc - but, the propertysheet/page captures some of these and does other things. How can I suspend the propertysheet/page from doing this, when the focus is on the subclassed edit?
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Your edit control should handle WM_GETDLGCODE and return DLGC_WANTALLKEYS
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
|
I have a Dialog application that has 4 grids(which are added as variables to the class ) and has a Com Server that this applications talks to .This is a multithreaded application where the Thread function populates the grids Now I add a new Flexgrid and the following happens :
Code runs Ok in the debug and Release configurations
When I go to class wizard and add a variable to this last grid like : m_grid5.
My code crashes in the release Configuration .
When i dont add a variable but access the grid using a Pointer by doing :
CMSFlexGrid *m_grid6=(CMSFlexGrid *)this->GetDlgItem(IDC_MSFLEXGRID_FILTER2);<br />
m_grid6->SetRows(1);
The code runs fine in the release mode .
I am not able to follow what internally is happenning or conflicting . Suggestions will be helpful .
Thanks
|
|
|
|
|
|
Hello.
I went here http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/hosting/wbcustomization.asp and took this example in the "Controlling Navigation" section of this article:
case DISPID_BEFORENAVIGATE2:
{
CComBSTR url = ((*pDispParams).rgvarg)[5].pvarVal->bstrVal;
if (url == "http://www.adatum.com" || url == "http://www.adatum.com/")
{
CComPtr<iwebbrowser2> spBrowser;
CComPtr<idispatch> spDisp = ((*pDispParams).rgvarg)[6].pdispVal;
spDisp->QueryInterface(IID_IWebBrowser2, (void**)&spBrowser);
spBrowser->Stop();
CComBSTR newURL = L"http://newdomain.com/newpage.htm";
spBrowser->Navigate(newURL, NULL, NULL, NULL, NULL);
((*pDispParams).rgvarg)[0].boolVal = TRUE;
}
break;
}
The question is:
If I click the link to "http://www.adatum.com" that opens in the same window then everything works fine and browser navigates "http://newdomain.com/newpage.htm". But in the case of holding shift or using in a href target=_blank or target="some_name" (i.e. opening link in new window) it navigates to "http://www.adatum.com".
Anybody knows what can be the problem?
I'm using IE 6.0 and Win2k
Thanks
|
|
|
|
|
To react on navigations when creating new browser windows you need to handle the NewWindow2 event (DISPID_NEWWINDOW2). There, you can intercept the creation of new windows and f.i. provide an IDispatch to your own browser, thus being able to handle DISPID_BEFORENAVIGATE2. There should be some examples about that on MSDN.
|
|
|
|
|
I'll try to explain what I see in the debugger.
This piece of code was used in a Browser Helper Object.
1 case DISPID_BEFORENAVIGATE2:
2 {
3 CComBSTR url = ((*pDispParams).rgvarg)[5].pvarVal->bstrVal;
4 if (url == "http://www.adatum.com" || url == "http://www.adatum.com/")
5 {
6 CComPtr<iwebbrowser2> spBrowser;
7 CComPtr<idispatch> spDisp = ((*pDispParams).rgvarg)[6].pdispVal;
8 spDisp->QueryInterface(IID_IWebBrowser2, (void**)&spBrowser);
9 spBrowser->Stop();
10 CComBSTR newURL = L"http://newdomain.com/newpage.htm";
11 spBrowser->Navigate(newURL, NULL, NULL, NULL, NULL);
12 ((*pDispParams).rgvarg)[0].boolVal = TRUE;
13 }
14 break;
15 }
I'll explain what I have while debugging:
variant 1 (opening link in the same window)
DISPID_BEFORENAVIGATE fires
string 12 works fine setting pDispParams->rgvarg[0] to True
browser Navigates to http://newdomain.com/newpage.htm
variant 2 (opening link in new window):
DISPID_NEWWINDOW2 fires
I use such string to cancel Navigation:
((*pDispParams).rgvarg)[0].boolVal = TRUE;
In debugger the value of pDispParams->rgvarg[0] becomes True but nothing happens...
DISPID_BEFORENAVIGATE fires
everything works like in variant 1 except that
string 12 doesn't work setting pDispParams->rgvarg[0] to {???}
browser Navigates to http://www.adatum.com
|
|
|
|