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
K

Koushik Biswas

@Koushik Biswas
About
Posts
38
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to find possible software developer companies
    K Koushik Biswas

    try www.rentacoder.com, they are an authentic market place

    Koushik Biswas

    IT & Infrastructure question sysadmin tutorial

  • Shutdown Computer Through C Program.
    K Koushik Biswas

    Though you are in the wrong forum, I will try. First of all, why this obsession with C? Why not a BAT file that has "/shutdown -s" typed in it, and use Windows Scheduler to run it whenevr you want? OK, so you are the "I will write my own program" kind of addict. Why not use the WinExec() Win32 API to execute the same BAT file? Create the BAT file and keep it somewhere on the hard disk. Now in the C program (which can take parameters like timer duration etc - that is your design, you can even pass the full path & name of theBAT file if you want your program to be generic) that will simply execute the BAT file at the specified time. Koushik Biswas

    C# help

  • How to display MAC Address to textBox (c# windows application)?
    K Koushik Biswas

    You get an article on the internet which shows you how to display something on the console. And you cannot get it dispplyed on a text box ? :laugh::laugh::laugh::laugh: Assign a string variable with the value and set the Text property of the textbox to that value. Judging from your question, you should not be dealing with Mac Addresses. Try displaying Hello World first. Koushik Biswas

    C# csharp help tutorial question

  • C++ to C#...care to help???
    K Koushik Biswas

    So now a days CP forums are replacing text books? Koushik Biswas

    C# question csharp c++ help tutorial

  • Databind xml to a treeview
    K Koushik Biswas

    Aha the urgent guy! So now you are back with a different title line. First of all, do you want only the DATA part of the XML in your tree view? If you go the normal examples shown in MSDN etc, you will get BOTH TAGNAMES AND DATA in your treeview. As you ar repeatedly asking the question, I am assuming that you need ONLY THE DATA (b'coz otherwise you would have altready got your answer from MSDN etc). Here is the basic idea of how you can do it. The whole code will be too complex to fit in here. First aof all see the MSDN example from (probably your post only): http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=450892&SiteID=1[^]. From that MSDN example, I will modify ONLY THE button1_Click() method. Not the AddNode() method. You have to follow a slightly different approach here:

    private void button1_Click(object sender, EventArgs e)
    {
    try
    {
    // SECTION 1. Create a DOM Document and load the XML data into it.
    XmlDocument dom = new XmlDocument();
    dom.Load(Application.StartupPath + "\\Sample.xml");

    // SECTION 2. Initialize the TreeView control.
    treeView1.Nodes.Clear();

    // SECTION 3. Populate the TreeView with the DOM nodes.
    if( dom.DocumentElement.Text == null || dom.DocumentElement.Text == "" )
    treeView1.Nodes.Add(new TreeNode(dom.DocumentElement.Name));
    else
    treeView1.Nodes.Add(new TreeNode(dom.DocumentElement.Text));

    if (dom.DocumentElement.HasChildNodes)
    {
    XmlNodeList nodeList = dom.DocumentElement.ChildNodes;
    for(i = 0; i<=nodeList.Count - 1; i++)
    {
    if( ! ( ( nodeList[i].ChildNodes.Count == 1 )
    && ( nodeList[i].InnerXml == nodeList[i].InnerText ) ) )
    AddNode(nodeList[i], treeView1.Nodes[0]);
    }
    }

    treeView1.ExpandAll();
    }
    catch (XmlException xmlEx) { MessageBox.Show(xmlEx.Message); }
    catch (Exception ex) { MessageBox.Show(ex.Message); }
    }

    Note: Instead of calling AddNode once (as shown in MSDN example) I am calling it for all the childnodes in a loop. That eliminates 1 layer - your trr view won't have the level 2 tags. But now in the AddNode() method, what do you do? Answer is you have to follow a similar logic. Note the catch logic:

    if( ! ( ( nodeList[i].ChildNodes.Count == 1 )
    && ( nodeList[i].InnerXml == nodeList[i].InnerText ) )

    C# xml question

  • using C# code in VC++(MFC) application
    K Koushik Biswas

    Sorry you cannot. Reason is simple - a user control in the MFC document-view architechture interacts with the framework using a unique messaging system. It is just not an external assembly that you plug in. The design is from Microsoft days when .NET was not there. A C# assembly can give you a GUI, but you cannot display it from a VC++ MFC document-view project. At least I am not aware of any miracle that will let you do that. Now coming to what practical alternatives you have. Firstly, believe me the C# tree control is not that great a control. It has numerous limitations that will frustrate you immensely. The very concept of a cool control that lets you do plenty of bells and whistles might have resulted in your brain being "c-sharpized". With some searching and luck, you will find numerous complex user controls/ Activex objects developed in C++ that you can highly use in your project seamlessly. If it is not a binding to use C# (which you can't), you may look around for cool controls developed in VC++. Codeproject has many, and other forums have many too. If you are more specific about the exact kind of control that you want, I can do some parallel searching too, if you don't mind that is ;) Koushik Biswas who else?

    C# csharp c++ design question

  • Urgent
    K Koushik Biswas

    Wooooow boy. Don't you sound like M? (The lady who orders James bond around?). Like when M calls James on a private line and just got time to deliver a 1 line message: "Urgent, Flying eagles are gettinng closer to Jumping Frogs" Listen buddy: If you don't try out some stuff on your own, you cannot survive eating on posts and forums. You seem to be exactly that kind of parasite who sucks but never gives. Next time try such a catchy title, and see how the community of back-savers gets back at you. Koushik Biswas

    C# xml

  • using C# code in VC++(MFC) application
    K Koushik Biswas

    It is easier said than done. Firstly, take a look at this article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkcominteroppart2cservertutorial.asp[^]. It will tell you that in order for C++ to call C#, the C# assembly should be written in such a way that C++ can treat it as a COM object. In your case, you want the UI part to be in C#, and for business logic and processing part you want to continue the C++ MFC code. So the better way is to do the opposite - make the C# call your existing C++ code. Create a new C# project, create your UI, and when it is time to code the business logic, make calls to a C++ DLL. Convert your C++ code to a COM object. Then you can call it directly from your C# application. See here on how to do that:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkCOMInteropPart1CClientTutorial.asp?frame=true[^] Now if you are too lazy to do COM, and if your C++ MFC code is not really so gigantic, you can consider a re-write. Create a C# project, create your desired flashy cool UI, and type in the business logic part in C# as well. As you have said "I am new to Dot Net" - by doing so you will be 1 step farther from calling yourself "new"...:-D Koushik Biswas who else?

    C# csharp c++ design question

  • IE has lost XML parsing ability - pls help!
    K Koushik Biswas

    Thanks Mike for the advice. Unfortunately it did not help :( Koushik Biswas

    System Admin tools xml json help question

  • IE has lost XML parsing ability - pls help!
    K Koushik Biswas

    Guyz out there, I think I did something silly wrong thing. I was playing around with the list that comes up if you open Windows Explorer --> Tools --> Folder Options... --> File Types. This list is a list of which executables to associate with which file extensions, so that when we double click a file, the OS knows which EXE to call. By the way, I have XP Professional SP2. I deleted a few extensions from that list. One of the things I deleted was XML, and it was associated with Altova XML Spy. I always hated that when I double click an XML file, Altova would open up, blatantly advertising what its paid version offers before I can see my XML file. I had in the past tried to re-associate the XML extension with IE, but somehow Altova always regains it back. So among others, I went ahead and deleted the XML extension too. I have also deleted tons of other extensions. Result: After that if I open an XML file with IE, IE does not "parse" it. It shows just as Notepad would :^) Can you please help me to regain my IE-XML tie up back? Thanks a lot for your time and patience! Koushik Biswas

    System Admin tools xml json help question

  • IE has lost XML parsing ability - pls help!
    K Koushik Biswas

    Guyz out there, I think I did something silly wrong thing. I was playing around with the list that comes up if you open Windows Explorer --> Tools --> Folder Options... --> File Types. This list is a list of which executables to associate with which file extensions, so that when we double click a file, the OS knows which EXE to call. By the way, I have XP Professional SP2. I deleted a few extensions from that list. One of the things I deleted was XML, and it was associated with Altova XML Spy. I always hated that when I double click an XML file, Altova would open up, blatantly advertising what its paid version offers before I can see my XML file. I had in the past tried to re-associate the XML extension with IE, but somehow Altova always regains it back. So among others, I went ahead and deleted the XML extension too. I have also deleted tons of other extensions. Result: After that if I open an XML file with IE, IE does not "parse" it. It shows just as Notepad would :^) Can you please help me to regain my IE-XML tie up back? Thanks a lot for your time and patience! Koushik Biswas

    XML / XSL tools xml json help question

  • for loop incrementing
    K Koushik Biswas

    If you do not want to make your for loop look anything other than the ordinary, but still want to skip processing the evens, use the continue keyword... for( i = 1; i <= 100; i++ ) { if( i % 2 == 0 ) continue; //.... } Koushik Biswas

    C / C++ / MFC question

  • Which forum is best for this question?
    K Koushik Biswas

    Hello, I tried this question in the C# forum for 2 days without any luck. As there is no forum called "Interop", I had chosen C#. (Subject: Call C# DLL from (unmanaged) C++: question on passing out string parameter) http://www.codeproject.com/script/comments/forums.asp?forumid=1649#xx1393501xx[^] Thanks a lot! Koushik Biswas If you would not be forgotten as soon as you are dead... either write things worth reading or do things worth writing. -- modified at 16:08 Friday 3rd March, 2006

    The Lounge com question csharp c++ tools

  • Call C# DLL from (unmanaged) C++: question on passing out string parameter
    K Koushik Biswas

    I have written a C# DLL that I intend to call from an unmanaged C++ app. I have so far followed all the rules that Microsoft explains in this article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkcominteroppart2cservertutorial.asp[^]. My ultimate goal is to have a method in the C# DLL which will populate a string OUT parameter, and call it from C++. Something like **void GetErrorString( int iErrorCode, ref string szErrorString )**. Now do not take that signature seriously - because that is what the question is! What should be the signature???? And how exactly do I call it from C++? So far I have tried: Attempt 1. C# signature: void Func2( int iCode, ref char [] szOut ); C++ call: char szRetString[ 128 ]; cpi->Func2( 10, &szRetString ); Result: Runtime error Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result. Variation: Instead of "ref" in C#, tried without ref. Same result. Attempt 2. C# signature: void Func2( int iCode, ref string szOut ); C++ call: char szRetString[ 128 ]; cpi->Func2( 10, &szRetString ); Result: Runtime error Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result. Variation: Instead of "ref" in C#, tried without ref. Same result. Attempt 3. C# signature: void Func2( int iCode, ref StringBuilder szOut ); C++ call: char szRetString[ 128 ]; cpi->Func2( 10, &szRetString ); Result: Runtime error Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result. Variation: Instead of "ref" in C#, tried without ref. Same result. And all the cross-variations of the above combinations as well!!!! Can somebody please tell me where am I going wrong? My C++ project does not have UNICODE defined. But please note that I have succeeded in calling the example provided by the MSDN article (link above) - which means I am successful in sending a read - only copy of string as IN parameter into C#. Ever wondered that microsoft examples avoid the harder part?;) Koushik Biswas If you would not be forgotten as soon as you are dead... either wri

    C# question csharp c++ html com

  • Editing a text file
    K Koushik Biswas

    /* First read your file into memory, 1 line per arraylist member */ ArrayList alLines = new ArrayList(); StreamReader sr = new StreamReader( "C:\\myfile.ext" ); string szLine = sr.ReadLine(); while( szLine != null ) { alLines.Add( szLine ); szLine = sr.ReadLine(); } sr.Close(); /* Done reading the file in memory. Now make all * the changes you want to make */ alLines[ 4 ] = "BLAH BLAH"; alLines[ 30 ] = "MORE BLAH BLAH"; alLines[ 56 ] = alLines[ 56 ].ToString() + " Appended string"; /* Write it back to the same file, overwriting */ StreamWriter sw = new StreamWriter( "C:\\myfile.ext" ); for( int iCnt = 0; iCnt < alLines.Count; iCnt++ ) sw.WriteLine( alLines[ iCnt ].ToString() ); sw.Close(); :) Koushik Biswas -- modified at 16:33 Thursday 2nd March, 2006

    C# help tutorial

  • Finding MousePointer in WinForms
    K Koushik Biswas

    Your question, at face value, sounds meaningless. Handle right click on the link button and populate the context menu accordingly (as it should be for the link button), and handle right click for the picturebox, and do the same in its handler. That's it! But obviously the fact that you have asked the question means that there is more to it than that! So what's more? Koushik Biswas

    C# csharp winforms question

  • Call C# DLL from unmanaged C++: question on string
    K Koushik Biswas

    I have written a C# DLL that I intend to call from an unmanaged C++ app. I have so far followed all the rules that Microsoft explains in this article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkcominteroppart2cservertutorial.asp[^]. My ultimate goal is to have a method in the C# DLL which will populate a string OUT parameter, and call it from C++. Something like **void GetErrorString( int iErrorCode, ref string szErrorString )**. Now do not take that signature seriously - because that is what the question is! What should be the signature???? And how exactly do I call it from C++? So far I have tried: Attempt 1. C# signature: void Func2( int iCode, ref char [] szOut ); C++ call: char szRetString[ 128 ]; cpi->Func2( 10, &szRetString ); Result: Runtime error Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result. Variation: Instead of "ref" in C#, tried without ref. Same result. Attempt 2. C# signature: void Func2( int iCode, ref string szOut ); C++ call: char szRetString[ 128 ]; cpi->Func2( 10, &szRetString ); Result: Runtime error Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result. Variation: Instead of "ref" in C#, tried without ref. Same result. Attempt 3. C# signature: void Func2( int iCode, ref StringBuilder szOut ); C++ call: char szRetString[ 128 ]; cpi->Func2( 10, &szRetString ); Result: Runtime error Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result. Variation: Instead of "ref" in C#, tried without ref. Same result. And all the cross-variations of the above combinations as well!!!! Can somebody please tell me where am I going wrong? My C++ project does not have UNICODE defined. But please note that I have succeeded in calling the example provided by the MSDN article (link above) - which means I am successful in sending a read - only copy of string as IN parameter into C#. Ever wondered that microsoft examples avoid the harder part?;) Koushik Biswas -- modified at 16:06 Thursday 2nd March, 2006

    C# question csharp c++ html com

  • How include extern DLL's as static Library into project?
    K Koushik Biswas

    OK, let the world be more "friendly" to this guy (or gal?)... If you want to do that with say MYDLL.DLL, then you must locate (or steal or beg or borrow or build) the .LIB file MYDLL.LIB. If you have the source code of MYDLL.DLL, then building the LIB file is a piece of cake. After you get the LIB file, link it statically by adding it to the Link tab of Project settings (do not forget to add its path to the Library path list in Tools --> Options --> Directories). If you do not have (or cannot get) the LIB file, you cannot do it. Koushik Biswas

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

  • permutations and combination
    K Koushik Biswas

    http://www.codeproject.com/cpp/CombC.asp[^] First google, then "codeproject" then ask in a forum. My google search string was "C++ choose r from n combination algorithm" - and the 1st hit was the above link. Searching on google is an art - and forums are there when that art fails (which it does sometimes). Koushik Biswas

    C / C++ / MFC

  • Suggestions for a C# Windows project to learn C#
    K Koushik Biswas

    Database is always a good choice - get some values, set some values, display the values on some controls. If your conception of hangman involves graphics (drawing on the windows form), that would not be particularly typical of what a person would do to get a "hang" of C#. But there is no right, no wrong. It is upto you. Drawing on the screen is real fun - but my personal view is most of the time in the professional world, you would not need that unless you are working for may be an ad company. Best of luck! Koushik Biswas

    C# database csharp game-dev help question
  • Login

  • Don't have an account? Register

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