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
C

Covean

@Covean
About
Posts
303
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to set pixel into bitmap with Pixel format of Format8bppIndexed ? [modified]
    C Covean

    Try this function to get a color supported by your currently selected palette.

    Greetings Covean

    C# graphics tutorial question

  • Cannot use a leading .. to exit above the top directory
    C Covean

    I think the name of the configurable aspx website is the problem '701-**...**the-market-of-1.aspx'. The function System.Web.Util.UrlPath.ReduceVirtualPath(String path) tries to reduce the paths '..'-value to the upper directory. Your path is an absolute path. Now the function has the problem to find the upper directory of the full root directory. This directory doesn't exist and thats why it spits this exception.

    Greetings Covean

    ASP.NET help java com design sysadmin

  • How to make a button that will copy two files and put them somewhere else
    C Covean

    mshome77 wrote:

    I am beginner in programming Visual Basic and i use the visual studio 2010 ultimate.

    Is this normal to pay around 4 - 5k € as beginner? :confused:

    Greetings Covean

    Visual Basic csharp visual-studio tutorial question

  • mailto - How to insert a URL hyperlink in the Body with DisplayText
    C Covean

    I don't know how to achieve this in javascript but your email body has to be a html body and not a plain text body as your sample code looks like. After you set this email property you can use html instead of plain text in your email body.

    Greetings Covean

    Web Development javascript com tutorial question

  • Can't see the exception of the code
    C Covean

    Yanshof wrote:

    In the pass ( visual studio 2008/2005 ) when i run on debug mode - i could see that the code stop and the IDE show me the line that cause the exception.This is what i want to see in the visual studio 2010 ...

    This is not completely correct, because the IDE only switches to the line if the exception is not caught anywhere (or you changed the settings under Debug->Exceptions). I do not have much experience with VS2010 but I think it behaves the same. I think your problem is, that somewhere this exception gets caught and a message box is displayed.

    Greetings Covean

    C# help question csharp visual-studio debugging

  • emptying texbox
    C Covean

    Maybe he means "an error message". Its very specific and helps to guess what your problem is. Next time write "My application crashs!" to get some more wild guesses.

    Greetings Covean

    C# help question

  • Copy raw file image
    C Covean

    I just only know this way ... so why should be something better to the only way I know ... better than what? Let me know if you know an other way, than maybe we could speak about things like that one way is better than the other ... but how should I be able to tell you if win32 api platform invoke is better than ... what???

    Greetings Covean

    C# com question

  • Constraints taking either types in generics
    C Covean

    What do you mean is a very bad idea, to have this 'OR' constraint? I don't think so. Take a look at this example: Lets say you want to add an extention to the values types short, int, long.

    public static class ValueTypeExtention
    {
    // A
    public static ulong ToUnsignedLongUnchecked(this T signedValue) where T : IConvertible
    {
    return signedValue.ToUInt64();
    }

    // B
    public static ulong ToUnsignedLongUnchecked(this T signedValue) where T : struct { ... }
    
    // C
    public static ulong ToUnsignedLongUnchecked(this short signedValue) { return signedValue.ToUInt64(); }
    public static ulong ToUnsignedLongUnchecked(this int signedValue) { return signedValue.ToUInt64(); }
    public static ulong ToUnsignedLongUnchecked(this long signedValue) { return signedValue.ToUInt64(); }
    
    // D
    public static ulong ToUnsignedLongUnchecked(this T signedValue) where T : short | int | long
    {
        return unchecked((ulong)signedValue);
    }
    
    // E
    public static ulong ToUnsignedLongUnchecked(this T signedValue) where T : (short | int | long) as IConvertible
    {
        return signedValue.ToUInt64();
    }
    

    }

    A, B and C are versions how you could solve this problem nowadays. But lets have a deeper look: - A allows bool bValue=false; ulong ulVal = bValue.ToUnsignedLongUnchecked();. It allows it for every class/struct that implements IConvertible. - B needs type checking and offers ToUnsignedLongUnchecked() to every struct even BITMAPINFO. - C is the only way to solve the condition completely but needs multiple implementations. Using where T : struct, IConvertible as constraints is the best way to solve this problem with generics so far. The 'pseudo' constraint D just allows T to be one of this 3 value types. And I think E could be the best way.

    Greetings Covean

    C# help

  • Constraints taking either types in generics
    C Covean

    In some situations I also think it would be nice to have this possibility. But take this example:

    public void MyGeneric<T>(T tValue) where T : InterfaceA | InterfaceB
    {
    tValue.<what>(); //<- and here is the problem - What interface do I access InterfaceA or InterfaceB?
    }

    I hope you see where your logical mistake lies.

    Greetings Covean

    C# help

  • Copy raw file image
    C Covean

    And what class from System.IO allows direct access to the hard disk/file system (and how)? And as I mentioned before, I don't know if there is a way without PInvoke, this doesn't mean there is no way!

    Greetings Covean

    C# com question

  • Copy raw file image
    C Covean

    This can be done in .NET / C# by using PInvoke. But on the other hand I think that accessing the file system directly from C# should be avoided. If you have problems to get started with this, google for "PInvoke" and try to figure out how to call Windows API from within C#. PS: To get a better start with this forum and all those helper/cpians here, please read the pinned forum guidelines at the start and try to think about / rephrase your question. One more sentences could avoid further inquiry.

    Greetings Covean

    C# com question

  • Copy raw file image
    C Covean

    If I'm right then he asks for a way to read all the file data plus the file system (NTFS as example) specific information. On a hard disk there are also a file header / footer for every file. Now this data he wants to read (and maybe) write. 1. Handle a file is the wrong approach you have to handle the file system in your case. 2. There is no class (or?) to read/write from/to the hard disk at this i/o level in C#. 3. Take a look at CreateFile. There is a possibility to read the physical disk.

    Greetings Covean

    C# com question

  • PInvoke with 32 bit native Dll in windows 7 64 bit
    C Covean

    You can't use a 32 bit dll in an 64 bit application (and vice versa). I'm not sure about native dlls but I think they behave the same.

    Greetings Covean

    C# csharp c++ help question

  • Data not Insert
    C Covean

    I'm not sure about access but you shouldn't use columns with names like 'date' because this is can also be a datatype in this database.

    Greetings Covean

    C# database help

  • Problem with Send Keys to background process
    C Covean

    1. I think in this case you can't use the SendKeys function, because they send the input to the window that has the focus. Can't you just switch the focus for this very short period of time to your app and than back to the app that had the focus before? 2. Ever tried to send KEYDOWN at first (try with ALT modifier set/unset) and after you sent left ALT + some key just sent an KEYUP event? Something like this:

    PostMessage(hWnd, KEYDOWN, VK_LEFTALT);
    PostMessage(hWnd, KEYDOWN, VK_F);
    Sleep(100);
    PostMessage(hWnd, KEYUP, VK_F);
    PostMessage(hWnd, KEYUP, VK_LEFTALT);

    Greetings Covean

    C# help tutorial question

  • Problem with Send Keys to background process
    C Covean

    If you understand C/C++ here is an old example where I send Ctrl+f to some window (hWnd).

    HWND hOldForegroundWindow = ::GetForegroundWindow();
    ::SetForegroundWindow(hWnd);
    ::ShowWindow(hWnd, SW\_MAXIMIZE);
    ::SetFocus(hWnd);
    Sleep(100);
    
    INPUT inputs\[2\];
    memset(&inputs\[0\], 0, sizeof(INPUT) \* 2);
    inputs\[0\].type = INPUT\_KEYBOARD;
    inputs\[0\].ki.wVk = VK\_CONTROL;
    inputs\[1\].type = INPUT\_KEYBOARD;
    inputs\[1\].ki.wVk = 70; // f
    
    ::SendInput(2, &inputs\[0\], sizeof(INPUT));
    
    Sleep(100);
    
    inputs\[0\].ki.dwFlags = KEYEVENTF\_KEYUP;
    inputs\[1\].ki.dwFlags = KEYEVENTF\_KEYUP;
    ::SendInput(2, &inputs\[0\], sizeof(INPUT));
    

    Maybe in your case you just have to wait some short period of time and send a KEYUP event.

    Greetings Covean

    C# help tutorial question

  • Problem with Send Keys to background process
    C Covean

    I think the problem is, that you send an ALT key but not left or right ALT, what is a big difference for the OS. VK_ALT is only used in user application the simplify some things.

    1. send VK_LEFTALT = 0xA4 or VK_RIGHTALT = 0xA5

    or

    2. use SendKeys.Send

    or

    3. Have a look at (low-level) windows key hooking (SetWindowsHookEx). This helps the understand how key strokes are queued in the windows messaging system.

    Greetings Covean

    C# help tutorial question

  • Location Change
    C Covean

    Not tested, but I'm really sure it does the following: It sets the correct top position at startup, but it lets the left position unchanged. If PayTop is not initialized, the window will always be opened at the top of the screen. This will be the execution plan I think:

    this.PayTextBox.LocationChanged += new System.EventHandler(this.PayTextBox_LocationChanged);
    this.PayTextBox.Top = this.objChequeTemplate.PayTop;
    // triggers ->
    objChequeTemplate.PayLeft = ((Control)sender).Left; // left is current left window position
    objChequeTemplate.PayTop = ((Control)sender).Top;
    // returns
    this.PayTextBox.Left = this.objChequeTemplate.PayLeft;
    // triggers ->
    objChequeTemplate.PayLeft = ((Control)sender).Left;
    objChequeTemplate.PayTop = ((Control)sender).Top;

    Greetings Covean

    Clever Code

  • Join tables from different server
    C Covean

    1. Some "more" (more than JOIN) information would help. 2. Read the guidelines at the top of this page. 3. Where is the question?

    Greetings Covean

    Database sysadmin help

  • What a trigger
    C Covean

    Thanks for that explanation, cause at first I thought that selecting a max value from a table to get a new id is a coding horror itself. But your statement explains nearly everything. (I had to use an Oracle-DB only one time and it was a "bittersweet" experience.)

    Greetings Covean

    The Weird and The Wonderful database csharp ruby sql-server oracle
  • Login

  • Don't have an account? Register

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