|
Instead of using the void main, I have integrate my 2 MFC to become one.. so it works perfectly fine..
|
|
|
|
|
Sounds like all you want to have is your app start once the linking processs has completed in the DevStudio. Correct? If so, then use the short cut Ctrl+F5 (unless it is mapped somewhere else). This compiles/links and then starts the app.
Larry J. Siddens
|
|
|
|
|
yes that's it. it also have an icon in the toolbar which look a red exclamation mark (next to the compile icon...
TOXCCT >>> GEII power
|
|
|
|
|
dreamerzz wrote:
For a normal Visual C++ program, we have a void main
Strictly speaking, it is int main()
|
|
|
|
|
dreamerzz wrote:
For a normal Visual C++ program, we have a void main
hey man, don't panic, it is not a normal Visual C++ program as he says... We are into a WinMainX()
TOXCCT >>> GEII power
|
|
|
|
|
Hi, id like to write some app using ISAPI. But i dont have Win 2k. I have installed IIS but i dont know if its enough? What else do i need to use ISAPI? Thanks.
|
|
|
|
|
A C compiler, some documentation and a hardy constitution. It is much easier using an App server designed for this purpose, such as this one [^].
onwards and upwards...
|
|
|
|
|
here is a query/problem that I am facing in my work:
We are developing an Windows application. The application is associated with a particular file extension - ".scm" wherein we can open a .scm file in the application either by launching the application and opening the file from File Menu or directly double clicking the .scm file. The app supports multiple document interface.
When user double clicks a .scm file, an instance of the application is started, file name is passed as command line parameter to it and it is opened in the App. Now the problem is every time when user double clicks a file, new instance of the application gets started. If an instance of the application is already running, instead of starting another instance, I want to use the same instance to open the file. In short I want to pass the control to the existing instance of the application.
If anyone has done this or has an idea about how to do this, can u please help me out.
Adi
|
|
|
|
|
In the file extension association, choose "Use DDE" to open files of type SCM.
onwards and upwards...
|
|
|
|
|
hello Basenetman can you clarify little more about the solution you suggested??
|
|
|
|
|
|
Adi Narayana wrote:
If an instance of the application is already running, instead of starting another instance, I want to use the same instance to open the file
See here and here.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
To further expound on the already mentioned single-instance code, you then need to pass the right data to the existing app.
One method I've used in a prodcut is to create a memory-mapped file to store the new filename and then broadcast a registered windows message to all apps. When the existing app sees this message it knows to open the memory-mapped file and read it's contents. Once it does that, it returns a correct response to the message which the app sending the message knows that it's done and can exit immediately.
If you need better details, let me know.
--
Joel Lucsy
|
|
|
|
|
Hello Joel,
thank u very much for the answer.
can u plz give any sample for the concept u explained above?
Thanks
Adi
|
|
|
|
|
Well, after determining that another instance is present, (I use the IsInstancePresent code from one of the articles here), and that you have a command line that you need to pass to the other instance, then do something like:
<br />
DWORD result;<br />
LRESULT ok;<br />
HANDLE fm;<br />
char *buf;<br />
CString fmn;<br />
DWORD pid;<br />
UINT MyProgMsgId;<br />
<br />
MyProgMsgId = RegisterWindowMessage( "MyProgMsg" );<br />
pid = GetCurrentProcessId();<br />
fmn.Format( "MyProg%ld", pid );<br />
fm = CreateFileMapping( (HANDLE)0xffffffff, NULL, PAGE_READWRITE, 0, 8192, fmn );<br />
buf = (char*)MapViewOfFile( fm, FILE_MAP_WRITE, 0, 0, 8192 );<br />
ZeroMemory( buf, 8192 );<br />
strcpy( buf, cmdline );<br />
ok = SendMessageTimeout( HWND_BROADCAST, MyProgMsgId, pid, 0, SMTO_BLOCK|SMTO_ABORTIFHUNG, 20000, &result );<br />
UnmapViewOfFile( buf );<br />
CloseHandle( fm );<br />
Make sure the RegisterWindowMessage happens in both cases (processing the command line and full GUI). Now the MFC gui codes need a line in the message map:
<br />
ON_REGISTERED_MESSAGE(theApp.MyProgMsgId,OnMyProgMsg)<br />
and the code handler will look something like:
<br />
LRESULT CRePlotDlg::OnMyProgMsg( WPARAM w, LPARAM l )<br />
{<br />
CString fmn, str;<br />
HANDLE fm;<br />
char *buf;<br />
<br />
fmn.Format( "MyProg%ld", w );<br />
fm = OpenFileMapping( FILE_MAP_WRITE, FALSE, fmn );<br />
buf = (char*)MapViewOfFile( fm, FILE_MAP_WRITE, 0, 0, 8192 );<br />
str = buf;<br />
UnmapViewOfFile( buf );<br />
CloseHandle( fm );<br />
ReplyMessage( TRUE );<br />
<br />
HandleURL( str );<br />
<br />
return TRUE;<br />
}<br />
Note that this is just an example and you'll have to make sure that certain variables belong to the right things, but it should give you a good starting point. If you need further explanation on anything, let me know.
--
Joel Lucsy
|
|
|
|
|
You could also store the window handle of your application's first instance in the memory map, then you don't have to broadcast the message, you can do a post message directly to the appropriate window instead.
|
|
|
|
|
In my case, the memory-map is not left open. It's only used to transfer data. By the time I need to use the MM, I already know the window handle.
The broadcast seems to work just fine, no delays or any other problems. Is there a good reason not to use it?
--
Joel Lucsy
|
|
|
|
|
I have a lot of the following in my code:
list.erase (remove_if (list.begin (), list.end (), ToDelete ()), list.end ());
Which just removes entries, if the predicate is met. Trying to be a bit smart, I tried wrapping this up in a nice little template to make it look nicer:
template<class Input, class Predicate><br />
void erase_if (Input input, Predicate p)<br />
{<br />
input.erase (remove_if (input.begin (), input.end (), p), input.end ());<br />
}
All looks great, only it doesnt remove any entries and I cant figure out why. It's probably something obvious, so any ideas?
|
|
|
|
|
Need to pass input into your function by reference:
void erase_if (Input& input, Predicate p)
But the compiler might have trouble matching that function signature to a template function (I don't know exactly what the rules are).
Perhaps if you wrote the function assuming Input was a pointer type, so you would use
<br />
input->erase (remove_if (input->begin (), input->end (), p), input->end ());<br />
That way the compiler would be forced to treat it as passed by reference, and you'd be forced to code it that way.
|
|
|
|
|
That did the trick and the compiler had no troubles. I knew it would be something simple, thanks!
|
|
|
|
|
Is there an option when designing a dialog for a password field, I cant find it anywhere in ActiveX controls options
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
You can use the simple edit control. Check the Password property (in the style tab)
|
|
|
|
|
I am using VC.NET so I presume that PasswordChar in the Appearence tab is the same thing.
Cheers.
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
Iam currently developing a graphics application using ATL that requires me to directly manipulate each pixel of a display by using the setPixelV operator. The problem Iam having is that even tho Iam drawing well with in the PRCBounds RECT I appear to be getting some weird 'echos' across the display when I draw past a certain point. These echos appear to be replications of things ive already drawn else where on the display. See http://uk.geocities.com/richyroo@btinternet.com/problem.jpg for an example, ive drawn the PRCBounds RECT in so there is no question of drawing outside.
This problem does not occur in the activeX test container only in Internet explorer.
Iam convinced that this is a deviceContext problem but have no idea where to start to try and solve this problem? Any ideas please?
[] /\ () X
|
|
|
|
|
Try this article. http://www.codeproject.com/tools/imageviewer.asp[^]
I wrote that app for solving just the type of wierd drawing problems you are experiencing. Although I have never used it for ActiveX, I am quite sure it will help you find out if it is your code that is causing the problem.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|