string exePath = Application.ExecutablePath; exePath = exePath.ToLower(); if (Application.ExecutablePath.ToLower().IndexOf("devenv.exe") > -1)//design time { } else { }
Miguel Lopes
Posts
-
Determining when application is running in debug mode -
Passing cmd line arguments to registry value during installHello, I need to pass a command line argument containing a database connection string to the registry. I pass it to a windows installer exe made with VS2005. I can obtain the string from inside the installer. But if i try to manually insert it, for example in void ProjectInstaller_Committed(object sender, InstallEventArgs e){...} i can read the registry but when i try to SetValue, i get an exception. Probably lack of permissions. Is there any way to do this? Thanks in advance!
-
Outlook plugin problemHi, Im writting an Outlook 2003 plugin. I have some folders with WebViewOn = true, which makes them avaiable to load a web page with a embebed c# user control. All working so far, except for an anoying detail :~ : All the controls exibit a strange-windows2000-like look and feel. Even text labels are weird, with bigger font. But if i call the webpage from Internet Explorer, all controls look ok. Does Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); have something to do with it? Thanks in advance!!!
-
Stupid CheckBox Behavior, please help!!Meh! Sorry for the inconveniance. I was handling the CheckedChanged Event, not the click event. It's my 1st .Net project, usually i do c++ stuff, and as i am still a bit suspicious about .net, i thought it was another weird VB-like think they had.:-> Thank you all for the quick response. :)
-
Stupid CheckBox Behavior, please help!!ok, im stuck in a very stupid situation. I have a checkbox, i change it's value through user input AND through runtime code. Problem: When i change the value by code, it fires the checkedchanged event, which, in my opinion, is pretty damn stupid. I know it works for most people, and it may look normal to most people, but for me is very stupid. Example: u have a checkbox that, when pressed, if a certain condition is met, calls a function and changes another checkbox state (or even himself), WITHOUT triggering the changedevent. Y? Cause i want to separate user input from runtime code changes and this stupid control (and others,from what i've seen) mix it all up! Do you know any property to avoid this or another event, to avoid this stupid behavior? Thanks in Advance!
-
print screen hook?Yeah, ive checked a few things and there are a lot of ways that this can fail. Regarding BitBlt(), i guess i could make a hook just for that, as it is a windows GDI function. Reguarding SnapShot, i've been reading an article here on codeproject on how to make a kernel-mode spying driver. Ill eventually have to make it, as it will be essential in the following months to my app. Combining a lot of these protection, i might then be able to completly protect the system from screenshots, and, who knows, even sell the overall protection system :)
-
MULTIPLE UNDOIn some cases, multiple undo's are too complicated to make like the 2 previous messages said, expecially, when deleting part of some complex structure. If you're dealing with text, which doesnt grow enormously, you could also keep a copy in memory of previous operations. If you specify a, lets say, 10 maximum number of undo's and the text doesnt exceed 50k, that wouldnt be such a bad approach, although its pretty ugly :-D:-D The method exposed before is much more neat and works for very large structure operations, but can also be difficult to implement.
-
print screen hook?Well, first, its only supposed to work on win2000+, so no legacy problem. Ive checked win32k.sys with PEView application and i didnt found, as you said, xxxSnapWindow as an exported function. Keyboard hook is no good, cause the printscreen message might not come from the keyboard, but might come by a call from a 3rd party capture application, which i want to avoid. Basically, i require an almost fail-proof mechanism to avoid screen capture in a specific window of my application. I have it all figured out when it's copied to clipboard, but when the capturing application saves it to file, i havent been able to stop it from happening. Other options could include a hook to a file write to disk, but that could have disasterouses consequences!!!
-
any articles written about cryptography for beginners??Best and easier way to protect is having an USB or paralel port security key... They are easy to implement and very secure, expecially if you make your code dynamically dependent on the existence of that key. Price: affordable for most commercial applications. If the application is to be used for a lot of computers in a domain, there are special keys that validate the application through the network. Software-based security is allways possible to crack, except in some very special cases.
-
How to Load/Save Image in database using VC++ MFCTake in account that saving images to a database is a terrible principle! Not only the DB gets big in no time, but the process of setting and retrieving images from the database is very slow! The best way is to store the images as files in the disk and then store the path in the database. Of course that can complicate your program, but if speed is a requirement, you should consider NOT saving them to the databse.
-
print screen hook?Hi. Thank you for the help so far!!! It has been of great help! It seems ill have to make, as you say, a kernel hook on SnapWindow... Ill start working on it, although im relativly new to global hooks. Any extra help would be appreciated!!
-
Remote desktopNo problem! My app is only supposed to work on win2000+. I know that in previous versions that might not work...
-
print screen hook?Hi, I need a global print screen hook, not based on keyboard hooks, but based on the actual process of getting the bitmap of the print screen. Does anybody know a place to start? Ive worked with keyboard hooks, but i dont know WHAT to hook for this specific thing!!! Thanks in Advance!!!
-
Need help understanding crash (using WinDbg)ive had some problems concatnating cstrings in some programs... i never figured out y, but it happened very often, cause it was in a function used many times per second. The same code in another part of the program worked fine! The stupid part was that if i added some code in the same funtion, the problem disapeared! Seemed like a compiler error, maybe because of optimizations :confused:
-
Remote desktopworks, but the compiler refused to accept the SM_REMOTESESSION value, even including "winuser.h", where it is defined. So, i just passed the value 0x1000 :) I know its a bad policy, but im not going to waste a lot of time with compiler sh$t.
-
Remote desktopMaybe this function works: GetSystemMetrics( SM_REMOTESESSION ); which returns a bool indicating wherever the user is using RD... havent been able to test it yet...
-
Remote desktopHi all, My application needs to know if it's running through remote desktop, to optimize graphics and stuff for low bandwitdh connections. Question: How do i automatically detect that the user is running my app through remote desktop? Thanks in advance!!
-
Problem converting solution from VS 2002Hi. I just installed VS2003 and started converting my programs from VS2002. All was woking fine till i reached a solution that, despite all my efforts, keeps poping this message: "The dynamic link library MFC70D.DLL could not be found in the specified path..." What is going wrong? Shouldnt VS detect that MFC70D.DLL is no longer used and that it should use MFC71D.DLL instead? Thanks in advance.
-
Simulating a disk file with a memory file?hi. I have a problem: I have the content of a file read in a BYTE array and i want to open that file with a COM component within my app. The problem is that this COM component only accepts files from a logical disk path. I can't write it to disk and then tell the COM component to fetch it because i have security issues and it would be very bad. Is there a way to simulate it or is there a very good way to camuflage a temporary file?(it cant be deleted while the program is in use) Thanks in advance!!
-
Active Reports VC++ Implementation GuideHi. I posted an Article Request/Ideas about this subject in the "Article Request/Ideas" forum. If anyone is interested in co-writing it, please let me know!!!