I am using the following code in order to start an MFC Win application from another MFC win application that is currently running: int CTransfer::StartNewProcess(CString szNewProcess) { STARTUPINFO si; PROCESS_INFORMATION pi; char szProcess[128]; szNewProcess += ".exe"; strcpy(szProcess , (LPCTSTR)szNewProcess); ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); // Start the child process. if( !CreateProcess( NULL, // No module name (use command line). szProcess, // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. TRUE, // Set handle inheritance to FALSE. NORMAL_PRIORITY_CLASS, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ) // Pointer to PROCESS_INFORMATION structure. ) { return 1; } // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); return 0; } The idea is that while the called window (modal) will be open the caller/creator will wait inactive until the user exits. This code will work with no issue under Win2000 and VS 2003. When I converted the projects to VS 2005 and I run them under Win 2003 I have the following strange bahaviour. The new window will show up but after a few seconds the caller will start processing/doing something because the mouse cursor will change to an hourglass. In addition to that in the Task Manager I can see two instances of the caller. So when I do Goto Process for each one of them, one will point to the caller.exe and the second one will point to the explorer.exe. I even created two new projects, because I thought that the conversion of the projects from 2003 to 2005 had the problem, but the bahviour is the same. If you have any idea / suggestion please let me know. Thank you in advance for your time. Spiros Prantalos Miami the place to be!!
Spiros
Posts
-
CreateProcess issue -
Trace Class questionI am using Trace in order to log information about the behavior of a web application. In web.config I have defined my Application Listener as following: As you can see all activity is logged in "d:\temp\activity.log". Is there a way to make this variable, that is changing by date automatically, such as: activity20041201.log, activity20041202.log, activity20041203.log etc. Thank you for your time Spiros Prantalos Miami the place to be!!
-
AdRotator with JavascriptHi everybody I am using asp:AdRotator in a web project and I was trying to make it work for popups instead of just showing the banner. So I wanted to have this rotation behaviour that will force a popup to show up each time, using the adRotator and an AdvertisementFile. Has anyone done that using this control? Thank you in advance for your time Spiros Prantalos Miami the place to be!!
-
ThreadPool ClassI am using ThreadPool class and I cannot find a way to return data from the callback procedure. Does anybody have any idea how to do that. Thank for your time Spiros Prantalos Miami the place to be!!
-
Print MarginsHi everybody Is there a way to change print margins in page setup synamically but without using an ActiveX? In fact using either Javascript or any other form of client side DHTML Thank you for your time Spiros Prantalos Miami the place to be!!
-
Javascript getElementByIdHi everybody I have a page with an asp repeater that consists of a list of radio buttons. I am using javascript in order to find the radio button that was checked. Everything works fine in IE but when I try it in NN 7.1 the following piece of code will produce an error. if (browser == "N") OnShipOptionChange(RadioButton_GetSelectedNN(window.document.getElementById("<%=m_methodid.UniqueID%>"))); <--this called else OnShipOptionChange(RadioButton_GetSelected(window.document.getElementById("<%=m_methodid.UniqueID%>"))); function RadioButton_GetSelectedNN(obj) <--the function called by the code above. { for(var idx = 0, max = obj.attributes.length; idx < max; idx++) { if(obj[idx].checked == true) <-- line that gives the error return obj[idx]; } return null; } The Error Message is: "obj[idx] has no properties". I have tried everything and I cannot make it to work. Any help will be highly appreciated. Thank you very much for your time Spiros Prantalos Miami the place to be!!
-
Access IDispatch from CHi everybody I have a COM object that has 1 method and it is dual interface written with VC++ 6.0. Is there a way to access it from a C program? Thank you for your time Spiros Prantalos Miami the place to be!!
-
Networking QuestionThank you for your help. After some research I found the following: -- Let's assume you have two Windows Forms applications, running on a single machine and you want the two applications to be able to communicate with each other. Or suppose you have a Windows service which should exchange data with your GUI application. Which protocol can you use? Remoting! This is one of the cases where the TCPChannel is extremely helpful as it allows you to specify rejectRemoteRequests="true" upon its construction which limits all incoming connections to the ones originating from your own machine. No need to take too many precautions about security in this case. However: If you use fixed port numbers for WinForms to WinForms communication, you might run into troubles when running on Windows Terminal Services with two or more users trying to use your application at the same time -- Unfortunately this is my case. Spiros Prantalos Miami the place to be!!
-
Networking QuestionThe whole application runs on Window Terminal Server Spiros Prantalos Miami the place to be!!
-
Networking QuestionHi everybody I an all the examples that I have studied so far with regards to remoting there is a server and many clients that communicate with it using either TCP/IP or HTTP. What kind of communication protocol can we use for the case of windows forms that communicate with other windows forms and need to pass data to them. So instead of having a pool of sockets to connect, we have the server (window form father) to create and then send data to the new window form (window form child) and then wait until the child window returns some results. If we use TCP/IP and config files all child processes will use the same port. From my small exeprience I believe that this is at least incorrect. So my question is: does anyone know am effective way to perform that type of communication? Thank you very much for your time. Spiros Prantalos Miami the place to be!!
-
C# and Named pipesHi everybody Does anyone know if there is a way to implement named pipes using C#? Thank you very much!! Spiros Prantalos Miami the place to be!!
-
Terminal Server ProblemHi everybody I am creating an application using VC++ that runs on a terminal server with 30 end users. The end users will use thin clients as front end machines. The application consists of a main menu executeble that opens other executables depending on the user selection. In order to establish that communication I use named pipes. Actually I use 1 named pipe as the main tube for data transfer. What happens is that sometimes the session of any user may freeze and another user may view his data. As a result I have started suspecting that something is wrong with the method that creates the child process and also that at a certain point one user may "use" the name pipe share of the other. The code that performs the above call is: int CTransfer::StartTalking(CString szNewProcess, CNamedPipe* m_ServerObject, char *pszBuffer) { STARTUPINFO si; PROCESS_INFORMATION pi; char szProcess[128]; strcpy(szProcess , (LPCTSTR)szNewProcess); ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); szNewProcess += ".exe"; // Start the child process. if( !CreateProcess( NULL, // No module name (use command line). szProcess, // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. TRUE, // Set handle inheritance to FALSE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi ) // Pointer to PROCESS_INFORMATION structure. ) { return 1; } #ifndef _DEBUG if (strlen(pszBuffer)) { DWORD dwBytesWritten; if (m_ServerObject->ConnectClient()) m_ServerObject->Write(pszBuffer , strlen(pszBuffer), dwBytesWritten); } #endif // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); return 0; } I am thinking that I could do certain things such as: 1. create 1 named pipe per module in order to distribute traffic to more named pipes. 2. use a CreateMutex before the CreateProcess and Release it before the WaitforSingleObject I will definitely appreciate any opion or help that you might provide. Thank you for your time Spiros Prant
-
Error connecting to SQL db using ADO.You need to specify the User that you use to logon and his password if there is any. For example if the user is sa with no password you should add after trusted connection User Id=sa;Password=; Spiros Prantalos Miami the place to be!!
-
Spellchecking problem with WORDHi everybody I am trying to use the CheckSpelling method of MSWord in order to check how a word is spelled. It works perfectly with English but I want to test also against Spanish words. Now I have installed Spanish in Word. I have checked that word must detect language change automatically and also when testing against Word spell check works fine with Spanish words. The method call that I use is: oWordApp.CheckSpelling(szWord, vOpt, vTrue, vOpt, vOpt, vOpt, vOpt, vOpt, vOpt, vOpt, vOpt, vOpt, vOpt); It seems to me that I cannot find a way to change the spellchecking language in runtime. I would appreciate any suggestion. Thank you very much. Spiros Prantalos Miami the place to be!!
-
SQL Server transaction LogThank you very much!! That was the solution!! Spiros Prantalos Miami the place to be!!
-
SQL Server transaction LogHi everybody I am using SQL Server 2000. The size of my actual data is 110MB. On the other hand the size of the respective transaction log is 7GB. Is the logical? If not is there a way to reduce it? Note that I use SQL Server's 2000 shrink menu option but the size will not reduce. IMHO this is tooooo much!!!! Thank you in advance for your help Spiros Prantalos Miami the place to be!!
-
Name Pipe ErrorI am writting a windows application that uses Namepipes for IPC. I have a strange problem which is that this IPC some times fails in a random way. It will work just fine for some time and then suddenly will thow an exception saying that the namepipe initiator is expecting for the other end to open the pipe. The main issue is that this behavior is random and so far there is no way to repeat the error when I want it. I would appreciate any ideas for handling this issue. Thank you in advance for your time. Spiros Prantalos Miami the place to be!!
-
Resource IdUsing that I have to provide the IDS_STRING1 which actually is the int value. What I am saying is to have the name on a string that is CString hhh = "IDS_STRING1" and with that to be able to find the caption of that the entry that has the same name in the string table Spiros Prantalos
-
Resource IdHow can I retrieve the resource of a entry in the string table. That is knowing the name, "IDS_STRING1" to retrieve the int value and thus to be able to retrieve the caption of the specific entry. Spiros Prantalos
-
COM alterativeHi everybody Using the previous version of Visual Studio when we would have to create a platform that will expose interfaces to front-end systems we would use configured COM+ components that would implement the IDispatch. What about the .NET approach? What if our project has nothing to do with internet and thus a Web service is not considered necessary. What type of approach we will use in such a case? Thanks Spiros Prantalos