Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

Ashok Dhamija

@Ashok Dhamija
About
Posts
82
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • .NET Code Easy to Disassemble
    A Ashok Dhamija

    If you are making a customized software for a particular customer, it is alright to give him the source code. But, when you are launching it as a generalized product to a large number of people, disclosing source code may not be desirable and is not necessary as a legal requirement. Even as per the moral requirements, it is not necessary because what will a common or lay customer do with your source code? He is simply a user of the product and that too one of a large number of users. But, your rivals will definitely benefit. Of course, if your target group is the open-source, you may very well disclose your source code. So, unless it is a customized software made for a particular customer only, a commercial application need not disclose source code. In today's cut-throat competition, it may not be advisable. So, disclosing source code of a commercial application may be injurous to your financial health. Heinz Suez wrote: But this doesn't apply to MS products, i haven't seen a bit of Windows src included rather than API methods calls in my apps. In some cases, even MS is also disclosing its source code, e.g., in MFC classes. Even for the .NET classes, you can see the code of the relevant dll files of MS, using the same ILDASM as for your code. Heinz Suez wrote: So i'm glad the way .NET works and if any of you are going to develop a commercial app then copyright it and apply all the legal stuff to it. So if you find your software cracked or ilegally modified you can theorically apply legal penalties to the cracker or whatever you wan't to call the victim. Legal processes are lengthy and costly. You may not be able to enforce your rights. Moreover, in an international scenario, enforcing legal copyrights becomes very difficult or almost impossible. Even a big corporation like MS has to live with a high level of piracy as the legal processes are not always productive or feasible. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# c++ csharp sysadmin json tutorial

  • static text
    A Ashok Dhamija

    Try using SetTextColor function of CDC by trapping the ON_WM_CTLCOLOR() message. In the message-handler OnCtlColor, use code like this:

    HBRUSH CMyDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);

    //Here m\_stText represents a CStatic control 
    if(m\_stText.m\_hWnd == pWnd->m\_hWnd)
    {
    	pDC->SetTextColor(RGB(0,0,155));
    }
    
    return hbr;
    

    }

    Regards, Ashok Dhamija _____________________________ Padam Technologies

    C / C++ / MFC tutorial

  • Timer that simply records the duration of a process
    A Ashok Dhamija

    Use the Interval property of Timer control to set the time interval after which you want to initiate some action. For example:

    Timer.Interval = 10; //This is 10 millisecond (i.e., one hundredth of a second), as required by you

    Then use the Tick event of the Timer control, which will then fire after every time interval set by you as above. In the event-handler of Tick event, use code to update time in the window as per your requirements. For example, override the OnPaint method of your window or control where you want to show time and use Graphics methods (Pen, Brush, etc.) to show the actual time. Then in afore-mentioned Tick event-handler, simply use a command like this.Refresh() to refresh the window which will call the OnPaint method to draw / show the updated time after every time interval set by you. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# csharp tutorial question

  • My Source Code is visible to all
    A Ashok Dhamija

    Heinz Suez wrote: Whow! It seems like a huge bug in the C# specification. It is not a bug but a deliberate design because the .NET applications are not compiled to native code but to the intermediate language code (called MSIL). This MSIL code is then compiled to the native code at the time when the user runs the program by using what is known as Just-in-time compilation. It is this MSIL code which is converted by "Lutz Roeder's Reflector" or ILDASM (supplied with Visual Studio) to show legible code. Heinz Suez wrote: 1) Whose this bug: C# or .NET Framework? 2) Does this happens in VB. NET? This problem is with .NET framework, so the code written in VB .NET can also be seen in a similar manner. Heinz Suez wrote: 3) Does this happens in C++ (native, not .NET) No, it does not happen in C++ native code. But, C++ .NET will have the same problem. Heinz Suez wrote: 4) Is C# 2.0 going to solve this issue? In the Beta version available for C# 2.0 as of today, this problem exists. One does not know about the final C# 2.0 product but the chances are that this problem is not being solved even in that. Hope it answers your question. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# question

  • My Source Code is visible to all
    A Ashok Dhamija

    C# applications have this problem of transparent code. You can try using an Obfuscator (one is supplied with Visual Studio itself) but it will solve the problem only partially. As of today, there does not appear to be a perfect solution for this problem. While you can make it more difficult for others to see your code or to reverse engineer it, but unfortuately there does not appear to be a perfect solution which could stop it absolutely. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# question

  • How to change cursor?
    A Ashok Dhamija

    Use the mouse move message to check whether the cursor is in the area of a control. For example, if you are using MFC, trap the ON_WM_MOUSEMOVE message and in the OnMouseMove message-handler, find the CRect area of the control (such as button) using functions such as GetDlgItem, GetWindowRect and ScreenToClient. And, then use the set cursor message (such as ON_WM_SETCURSOR) and in its handler, first check whether the cursor point is in the aforesaid CRect area of the specific control and if so, use SetCursor function to change the cursor. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C / C++ / MFC tutorial question

  • DLL project not producing the .LIB file
    A Ashok Dhamija

    If a DLL has no exports, the linker will not generate a .lib file. See http://msdn.microsoft.com/library/en-us/vccore/html/vcurfLinkerPropertyPages.asp[^] Regards, Ashok Dhamija _____________________________ Padam Technologies

    C / C++ / MFC help c++ question

  • Application metering
    A Ashok Dhamija

    If your purpose is to just record the application usage and that too only for one application [or per application], then you can also consider the simple solution of using the DateTime.Now method at the time of start of your application and the closure of your application. Do it from that application itself. And, store these values in some file or place on the user machine in the form of some log file or otherwise. On the other hand, if your purpose is to "monitor" your application in some other manner (say by way of initiating some other action on the system), then you may consider some other solution depending upon the type of requirement. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# question csharp c++

  • Form Controls
    A Ashok Dhamija

    There is a FindControl method referred to by you in the System.Web.UI.Control class. However, apparently there is no such method in the System.Windows.Forms.Control class from which the Form class is derived. But, as suggested by Christian Grauss, you can use the Controls property of the Form class alongwith the ControlCollection class member methods to iterate through the controls on a form. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C#

  • BMP File
    A Ashok Dhamija

    If you are referring to the creation of a bitmap file for the purpose of using it as a resource in the VC++ project, then click on the Add Resource menu-item on the Project menu. A dialog box called Add Resource will appear on the screen. Select Bitmap and then click on the New button. You'll get a blank bitmap file drawing area from where you can draw your own bitmap file. As an alternative, you can draw your own bitmap file using some standard drawing software such as Paint and save it as bmp file and then click on the Import button in the aforesaid Add Resource window to import the same. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C / C++ / MFC c++ graphics tutorial

  • BMP File
    A Ashok Dhamija

    If you are referring to the creation of a bitmap file for the purpose of using it as a resource in VC++ project, then click on the Add Resource menu-item on the Project menu in the VS IDE. In the dialog box appearing on the screen, select Bitmap and then click on the New button. You'll have a blank bmp file material where you can draw / create your own bitmap. Otherwise, you can also draw your bitmap file (with bmp extension) in some other software such as Paint and then import it using Import button in the aforesaid Add Resource dialog box. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C / C++ / MFC c++ graphics tutorial

  • Button Click -> to Paint handler??
    A Ashok Dhamija

    You can use Invalidate method in the button click event handler which will repaint the window; so in the OnPaint you can put the code for drawing the line. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# question graphics

  • Form Controls
    A Ashok Dhamija

    You can also use the Controls property of the Form class for this purpose. It returns an object of the Control.ControlCollection class whose members can be used for the purpose desired by you. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# tutorial

  • Dialog box exit
    A Ashok Dhamija

    As you have an AcceptButton, it appears that the Click event of the OK button precedes the KeyDown event for the Enter key and kills the dialog box before the KeyDown event fires. Try NOT declaring the AcceptButton and then see whether the KeyDown event fires for the Enter key. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# question

  • getting file bytesize
    A Ashok Dhamija

    Try using Refresh() method of FileInfo class before calling the Length property every time you want to update it, i.e.,

    fiMyFile.Refresh();
    lLengthMyFile = fiMyFile.Length;

    Though I have not checked it in the context of your application (but it worked in my application having some different requirements), it may work if the character is being written in the file as it is being typed. Another way out could be to use the Length property of FileInfo as above as and when you save the file. And, after that as the characters are being typed, you keep a count of the characters / bytes of the unsaved data and add it to the Length calculated earlier for the saved data. I hope it works. Regards, Ashok Dhamija _____________________________ Padam Technologies -- modified at 1:13 Monday 19th September, 2005

    C# debugging help question announcement

  • serial number for my application
    A Ashok Dhamija

    Almost no such method is hacker-free. Only thing is how more difficult you can make it. You can use some hardware-related factors to create your serial numbers / copy-locking methods. You can also have some method to create some random number at the time of the first run of the software. But, you'll have to create your own algorithm. Search "serial number" in Code Project articles, and you'll get some useful material. Here is the first article in this search: http://www.codeproject.com/csharp/hard_disk_serialNo.asp[^] Alternatively, you can consider some third-party solution. Google with phrases such as "copy protection", "software protection", and the like, and you'll get tons of such third-party applications. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# algorithms question

  • getting file bytesize
    A Ashok Dhamija

    You can try using the simple alternative of FileInfo.Length property to get the size of a file in bytes. If strMyFile represents the full name-path of the your file, then

    FileInfo fiMyFile = new FileInfo(strMyFile);
    long lLengthMyFile = fiMyFile.Length;

    This will give the size of your file in bytes. Use the "using System.IO;" at the beginning for accessing FileInfo class. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# debugging help question announcement

  • Auto generated code breaks
    A Ashok Dhamija

    What appears to me is that when the default ResourceManager method with one parameter, i.e., ResourceManager(typeof(DetailsActions)) is called, it is getting called in the correct assembly (i.e., "RDC") because the error mentioned by you clearly shows the name of the assembly being searched, i.e., "Make sure "DetailsActions.resources" was correctly embedded or linked into assembly "RDC"." So, when you compare the aforesaid single-parameter ResourceManager method with the two-parameters method namely ResourceManager("RDC.controls.DetailsActions", System.Reflection.Assembly.GetExecutingAssembly()), it appears that the assembly is being identified correctly. The only problem is that the call to typeof(DetailsActions) is resulting into something like "DetailsActions" instead of resulting into the required fully qualified Namespace / path of "RDC.Controls.DetailsActions". So, perhaps what is required to be done is that when the InitializeComponent method of the user control is called for the purpose of constructing the embedded resources, it should make typeof(DetailsActions) to produce fully qualified Namespace / path of "RDC.Controls.DetailsActions". So, I wonder whether the Namespace mentioned in the source file containing the user control can be changed to the fully qualified Namespace of "RDC.Controls...." if it is not so already and whether it helps in solving the problem. If it does not help (unfortunately I cannot visualize your actual code), you may please try to somehow ensure that the typeof operator when run on the class of user control returns the full Namespace path. This problem might perhaps have arisen due to the user control having been initially designed in one environment and then the same being copied to a different solution leading to conflict of namespaces. As an alternative, you may also try changing the default namespace to the fully qualified namespace (if not so already) in the properties of the project containing user control. I can only hope that it works. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# help csharp c++ asp-net winforms

  • Saving configuration option data
    A Ashok Dhamija

    You can consider using the Registry to save your configuration data. Proceed as under (with MFC): 1. Use functions such as SetRegistryKey, WriteProfileString (for a string), WriteProfileInt (for int), GetProfileString, GetProfileInt, etc., of the application class for setting and accessing values from the Registry. 2. You can consider the Constructor or InitDialog functions wherein the stored values can be retrieved from Registry and displayed in the Configuration dialogbox. 3. Use OnOK (or whatever other button-event-handlers) to save the changed configuation data to registry. 4. Use these stored values appropriately in the code to change your program response. For example, use PreCreateWindow function of the mainframe class to change the position or size of main window using stored configuration data. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C / C++ / MFC tutorial workspace

  • Auto generated code breaks
    A Ashok Dhamija

    There can possibly be three reasons (however, in your problem, reason No. 1 below is more probable) for the problem: 1. The default resource file should be in your main assembly. When you use the following code:

    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DetailsActions));

    the resources are not found in the assembly in which they are being searched. However, when you are giving the details of the assembly in which the resources are available (as well as when you are giving the full qualified path of the resource by providing “RDC.controls.DetailsActions”) by way of the following code:

    System.Resources.ResourceManager resources = new System.Resources.ResourceManager("RDC.controls.DetailsActions", System.Reflection.Assembly.GetExecutingAssembly());

    the search for the resource concerned is conducted in the right assembly whose details are now available in the command System.Reflection.Assembly.GetExecutingAssembly(). So, basically it is a question of giving the default name and path vis-à-vis the fully qualified name and path. When you supply the fully-qualified name and path, the resource can be located, whereas with the default name and path the resource cannot be found. 2. The resource is marked as private. This is what MSDN describes: Resources marked as private are accessible only in the assembly in which they are placed. Because a satellite assembly contains no code, resources private to it become unavailable through any mechanism. Therefore, resources in satellite assemblies should always be public so that they are accessible from your main assembly. Resources embedded in your main assembly are accessible to your main assembly, whether private or public. 3. The third reason could perhaps be when you are using satellite assemblies for different cultures and when you are not providing the correct path for the resource for the particular culture being used. However, apparently this is not your problem, because your problem is getting resolved when you provide the fully qualified name and path. So, apparently the answer to your problem lies in the reason No. 1 above. To ensure that the problem does not occur, be sure to keep the resource at the appropriate place in a conscious manner and give full name and path. Regards, Ashok Dhamija _____________________________ Padam Technologies

    C# help csharp c++ asp-net winforms
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups