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

KingTermite

@KingTermite
About
Posts
76
Topics
21
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ERROR_MORE_DATA on RegQueryValueEx()
    K KingTermite

    Blake Miller wrote: Maybe you did not fill in the buffer size on input? Thank you. I feel so stupid. I had this working before, but then copy/pasted the code to create a library. I left that var at 0 and was thinking that was the size of the data returned, not for "me" to fill out.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C / C++ / MFC help windows-admin question

  • ERROR_MORE_DATA on RegQueryValueEx()
    K KingTermite

    Nobody has seen this or had this problem? :(


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C / C++ / MFC help windows-admin question

  • ERROR_MORE_DATA on RegQueryValueEx()
    K KingTermite

    Playing around with some registry stuff.... I'm making a call to RegQueryValueEx() with the returnstring buffer that is 4K. I am continually getting a system error code of ERROR_MORE_DATA. When I look at the data in the dubugger, it's about 400 characters. Could there be another problem that would give that error code?


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C / C++ / MFC help windows-admin question

  • PropertyPage help instantiating
    K KingTermite

    Mike Danberg wrote: As far as the problem with the third tab error, you can't access a control on the other tab. It's exactly the same as having a dialog that's not open yet. The control isn't there, so you can't access it. Hope that helps. Can't really tell you much more since I don't know exactly what you're doing. Well....I was trying to find a way to make sure the dialog "was there" so I could access the control. Here's more on the problem (fixed now btw) just for information...I couldn't post a code snippet as it is a work project (IP and all that crapola ya know). It is a power pnael interface for a test station and one tab is a "health monitor" and the two other are two seperate "power" panels for powering up power supplies. The health monitor needs to inactivate monitor controls for power supplies that are not powered. the logic was there for them to safely not run, but I wanted to make the controls visibly disabled to show that they weren't evens selectable while power supplies were not powered up (checkboxes). However, OnSetActivate() was just the trick I needed (and didn't know). I overrode that function and now when that tab is pressed (instead of during the other tab's processing), I can deactivate the controls. Thanks. :)


    There are only 10 types of people in this world....those that understand binary, and those that do not.

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

  • PropertyPage help instantiating
    K KingTermite

    Ok....forgive my ignorance...I'm a relative newbie in VC++....I've done a little, but that's about it. I have a dialog/propertysheet that has 3 tabs (propertypages). When it comes up it is on the first tab. If I click on the third tab, I get an error during one operation because its trying to access a control within the 2nd tab's window and apprently it doesn't instantiate until clicked on. If I click on the 2nd tab first, then run that operation, it works like a champ. But if not, the pointer to that propertypage is still null. How can I instantiate that propetypage when the program starts up, regardless of whether it was clicked or not. If there's a way, I may as well instantiate all proppages at once. Any suggestions are appreciated.

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

  • Keeping Window On Top
    K KingTermite

    Dialog.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C / C++ / MFC question help

  • Keeping Window On Top
    K KingTermite

    Sorry...I guess I did make that a bit unclear. I didn't mean the window wasn't visible, just minimized. I want it to start non-minimized.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C / C++ / MFC question help

  • Keeping Window On Top
    K KingTermite

    I have this code snippet used to keep the window on the top. // Make this window stay on top, so it never leaves opertor's view. SetWindowPos( &wndTopMost, 0,0,0,0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW ); The problem is that is starts minimized...how can I ensure this window starts visible?


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C / C++ / MFC question help

  • Make Window Stay On Top
    K KingTermite

    You are my superman! ;) It wasn't exactly right, but (hang on..moving window now in my way)....it was damn close! :) Appreciated!


    There are only 10 types of people in this world....those that understand binary, and those that do not.

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

  • Make Window Stay On Top
    K KingTermite

    I'm not too saavy in Visual C++ programming as most of my C/CPP has been in embedded platforms. I'm working on a host application which is a VC++ window. Essentially, for this one particular window I want it to stay on top all the time. I have added some code that was given to me by someone who has done it in another application before, but it does not seem to be working in mine. Can anyone help? Here is what I have:

    				CWnd appWnd;    // the application CWnd
    				CWnd *pAppWnd;  // a pointer to CWnd
    				pAppWnd = & appWnd;
    				pAppWnd = AfxGetMainWnd();
    
    				if (NULL != pAppWnd)
    				{
    					HWND appHandle; // window handle
    					appHandle = pAppWnd->GetSafeHwnd();
    
    					if (NULL != appHandle)
    					{
    						targetObj.m_pAppWnd = pAppWnd;						
    					}
    				}
    
    		// Cause window to stay on top
    		targetObj.m_bWindowStayOnTop = TRUE;
    

    targetObj is another class which is essentially being called by this (no "gui" elements in that class) and in that class, inside of a loop that he is in, I have this part:

    						// Used to keep parent window (test module) on top
    						if (TRUE == this->m_bWindowStayOnTop)
    						{
    							BOOL bReturn = FALSE; 
    
    							if (NULL != this->m_pAppWnd)
    							{
    								bReturn = this->m_pAppWnd->SetForegroundWindow();
    							}
    						}
    

    It seems that the return from SetForegroundWindow() is 0 which means it is failing. But I don't know why! Any ideas?


    There are only 10 types of people in this world....those that understand binary, and those that do not.

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

  • numericUpDown Control - double digits?
    K KingTermite

    Yes, I did read the documentation, the problem is that Microsoft documentation isn't always as solid as it could be. Once you've "done it", then you see in retrospect how to "do it", but that doesn't mean the documentation just explains every nuance. Far from it usually. That was why I said up front that I knew it was possible if I inherited the class, but wanted to make sure there wasn't a proprety or something like that I was missing. I'll keep that in mind about the ildasm.exe....I remember you showing me that on the COM DLL problem I had last week.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# css question

  • numericUpDown Control - double digits?
    K KingTermite

    Thank Heath...that's kind of what I thought. I figured I'd have to inherit/extend it to make it work. I just wanted to make sure there wasn't a property for it that I missed before I went through all the trouble.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# css question

  • numericUpDown Control - double digits?
    K KingTermite

    I am using a numericUpDown control which represents a minutes (for time) value. I want it to display 00, 01, 02, etc... for numbers less than 10. Is there a simple way to do this with a property (I reviewed the documentation, but didn't see anything immediately)? I know I could do it if I inherit the control, but I was hoping for a simple property or somethign to accomplish it. Something that I missed in the documentation. Can it be done without inheriting it?


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# css question

  • COM/C# datatype mismatch
    K KingTermite

    Ok...I got it (what a pain)! I want to post the answer here for posterity in case somebody else has a similar problem in the future. For the record, I found the answer in a book a co-worker lent me (COM and .NET Interoperability by Andrew Troelsen). The VB function signature:

    Public Function MyFunction(varNames() As String) As String()
    

    showed up as this in the assembly like this:

    .method public hidebysig newslot virtual 
    instance string[] 
    marshal( safearray bstr) 
    MyFunction([in][out] string[]& marshal( safearray bstr) varNames) runtime managed internalcall
    {
    .custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 15 00 03 60 00 00 ) // .....`..
    .override COMInterface._COMClass::MyFunction 
    } // end of method COMClass::MyFunction
    

    The problem was this assembly (and intellisense) was telling it it had to be a safearray and apparently it just wouldn't take a string[]! Not even if it was instantiated on initializaation like:

    string[] varNames = new string[] {"One", "Two" };
    

    The intellisense was telling me it had to be a "System.Array", not a string[]! What needs to be done is not a "cast", but intantiating a System.Array and set it equal to the string array that was initialized and then pass in the ref to that array. This was the way to get it working was:

    COMInterface.COMObj oCOMObject = new COMInterface.COMObj();
    			
    string[] sNames = new string[] { "ProjectName" }; // 1 element array
    System.Array oTemp = sNames;
    string[] sValues = new string[1];
    System.Array oTempVals = sValues;
    oTempVals = oCOMObject.TheCOMFunction( ref oTemp );
    

    It wasn't intuitive....but now, in retrospect, it makes sense. Apparently you have to use the "System.Array" type for the "safearray" that it expects in the assembly, and since it doens't like you to cast it from string[] to System.Array, you have to just create an instance and set it equal.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# csharp help css visual-studio com

  • COM/C# datatype mismatch
    K KingTermite

    Thanks for the offer. It is sent.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# csharp help css visual-studio com

  • COM/C# datatype mismatch
    K KingTermite

    Heath Stewart wrote: Yes, VS.NET does create the interop assembly but you never said you added such a COM reference and I've learned to assume nothing in this forum. After all, you did give the VB6 method signature and said you were trying to call it. The data type (not C#, but .NET) is a String[] array, as well as is the return value, just as I mentioned previously. The param indeed takes a ref as designated by the address operator, &. More easily, however, would've been to look at the signature that IntelliSense returned, which would've shows the method signature as it is declared. It should look something like this: Yes...you are right...sorry ".Net", not C#. ;) Sorry I didn't mention the reference...this is my 1st time playing with COM and that is the only way I knew how to do it. So I just assumed that was assumed. If that makes sense. Thanks for your answer, but if you go back to my original post, you'll see from my code examples that was exactly where I started. So...full circle?


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# csharp help css visual-studio com

  • COM/C# datatype mismatch
    K KingTermite

    According to that link (and another article I've found), when you add the COM reference to the project in VS.Net, it automatically converts it for you so that you are "on the same page". Anyway....I found the assembly info you were talking about....I had to use a VS.Net command line tool called ildasm (which I didn't know about before). But anyway...here it the info it generates: .method public hidebysig newslot virtual instance string[] marshal( safearray bstr) MyFunction([in][out] string[]& marshal( safearray bstr) varNames) runtime managed internalcall { .custom instance void [mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01 00 15 00 03 60 00 00 ) // .....`.. .override COMInterface._COMClass::MyFunction } // end of method COMClass::MyFunction I'm still trying to match the C# datatype for the argument for that VB6 COM function.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# csharp help css visual-studio com

  • COM/C# datatype mismatch
    K KingTermite

    Sorry...I'm lost. I found the command line version of the tlbimp.exe but didn't have much success. I ran it on the vb COM dll (it was created such that type library is built in I'm told), and it created an "imported" version of the dll in the program files\common files\....1033\nt directory. When I tried viewing that type library it couldn't load it. I don't see the option to do what you are saying VS.Net. If you (or anybody) and just mention that a bit more, I'd appreciate it. I have to run now, but I'll check again 1st thing in am. Thanks for all your help so far. :)


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# csharp help css visual-studio com

  • COM/C# datatype mismatch
    K KingTermite

    Oh...sorry..I got ya now. And no, it didn't use ref, I didn't think it did. I was only trying that after it didn't work originally without the ref thinking maybe I needed that to send it in. This is the interop assembly (the type lib you mean I hope...this is my first taste in COM). SAFEARRAY(BSTR) MyFunction([in, out] SAFEARRAY(BSTR)* varNames);


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# csharp help css visual-studio com

  • COM/C# datatype mismatch
    K KingTermite

    Yeah, I know what you're saying. The signature was the first code section/line. I tried it first without the ref, assuming that was the correct way (most of my experience being a C programmer). That just gave me the same error. This one shows up too: D:\CSS\Dev\ProjName\ClassName.cs(255): Argument '1': cannot convert from 'string[]' to 'ref System.Array'. BTW...also to note, the new C# must match the existing VB signature because that is a long time used COM object so interface can't change.


    There are only 10 types of people in this world....those that understand binary, and those that do not.

    C# csharp help css visual-studio com
  • Login

  • Don't have an account? Register

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