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
S

sinosoidal

@sinosoidal
About
Posts
110
Topics
55
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to capture "What I see" in my monitor, in a Windows 7 in realtime with a really highframe rate?
    S sinosoidal

    Hi, I need to capture the whole desktop frame buffer, process it and then have it displayed again or streamed. The first questions is really how do I capture the DWM final result of the composition as an image? Do I need to go down level to the driver layer? OR is there any API that could help me with this? How does VNC does the job? Can DWM help me directly on this? If anyone could give me a tip here, that would be wonderfull. Thanks, With my best regards, Nuno

    COM question json help tutorial career

  • How to make a raw PDO device accessible from user mode code in control panel?
    S sinosoidal

    Hi, I made it! I have read the document you passed me and decided to create a more open SDDL which I defined as: DECLARE_CONST_UNICODE_STRING( MY_SDDL, L"D:P(A;;GA;;;SY)(A;;GRGWGX;;;BA)(A;;GA;;;WD)" ); And gave to the world GA permissions. My question now is.. what are the implications of having a not so restrictive security options? What are usually the SDDL for custom devices? Thanks, Nuno

    Hardware & Devices help tutorial question

  • How to make a raw PDO device accessible from user mode code in control panel?
    S sinosoidal

    Hi, I have a raw pdo device which sample code needs administrative rights in order to work, othwerwise fails with an access denied error. Which SSDL should I use to have it working under user mode code? I have tried SDDL_DEVOBJ_SYS_ALL but this specifies that the code must run as system. I'm trying to put the sample code that right now runs on the console, into a control panel applet. Should the applet run as system? Some help would be really appreaciatted. Thanks, Nuno

    Hardware & Devices help tutorial question

  • Access denied opening raw pdo
    S sinosoidal

    Hi, I'm trying to set up raw pdo and i'm basing myself on the kbfilter example. I used the code on the sample to put it on my device driver based on the hidfx2usb sample. However, when I tried to open the raw pdo thru its guid I have an access denied. How can i debug such error? How can I know why is it having an access denied? Any tips? Thanks, Nuno

    Hardware & Devices question debugging help tutorial

  • Raw PDO... how to make it associated correctly with a device
    S sinosoidal

    Hi, I'm trying to setup a Raw PDO. I'm trying to do this because i'm writing a driver which is based on the hidfx2usb sample and it maps the usb device into a hid device. the thing is that i can't access directly the device from the user space because the hid class blocks the requests. i've been told to create a raw pdo device to have direct access to the device. i had a look to kbfiltr and there is created a pdo, but the example registers a pdo for a keyboard and my device is a usb device. my question is about how to associate the pdo to the usb device. in the example the base string for the pdo registering is this: #define KBFILTR_DEVICE_ID L"{A65C87F9-BE02-4ed9-92EC-012D416169FA}\\KeyboardFilter\0" How should I register a pdo for a usb device? Thanks, Nuno

    Hardware & Devices tutorial question workspace

  • How to access device context data?
    S sinosoidal

    Hi, I'm developing a kernel mode driver to handle a USB device. The device is always sending packets of data. That data, after 16 packets becomes 1 entire frame. That frame will then be delivered for a next phase processing. This frame is kept on the device context structure. However, I also would like to retrieve that data from the user space. I want to create an application to visualize that frame. The question is... what are the mechanisms to communicate from the kernel side to the user side? How can I access device context in order to get this piece of data from the kernel side in the user side? I hope to be clear enough, Thanks, With my best regards, Nuno

    Hardware & Devices question tutorial

  • How to pass a pointer of data to the managed side on a C++ wrapper
    S sinosoidal

    Hi, I'm doing a simple managed C++ class to grab data from a USB device and pass it to the C# side. This is my class: public __gc class Communication { private: LPVOID dataInBuffer; HANDLE _hFileHandle; int nBytesToRead; int maxPacketSize; public: Communication() { _hFileHandle = INVALID_HANDLE_VALUE; maxPacketSize = 256; dataInBuffer = malloc(sizeof(char) * maxPacketSize); nBytesToRead = maxPacketSize; } ~Communication() { if( _hFileHandle != INVALID_HANDLE_VALUE ) { CloseHandle( _hFileHandle ); } } bool OpenDevice( String* driverName ) { char* lpFileName = new char[driverName->Length + 10]; sprintf( lpFileName, "\\\\?\\%s", driverName ); _hFileHandle = CreateFile((LPCSTR) lpFileName,GENERIC_READ,0,0,OPEN_EXISTING,0,0); if( _hFileHandle == INVALID_HANDLE_VALUE ) { puts("Couldn't not open device"); } delete lpFileName; return( _hFileHandle != INVALID_HANDLE_VALUE ); } BOOL CloseDevice() { return CloseHandle( _hFileHandle ); } int GetPacket() { char outBuffer[256]; int nBytesRead = -1; if (_hFileHandle!=INVALID_HANDLE_VALUE) { ReadFile(_hFileHandle, dataInBuffer, nBytesToRead, (PULONG) &nBytesRead,0); } memset(outBuffer,0,maxPacketSize*sizeof(char)); memcpy(outBuffer,dataInBuffer,maxPacketSize*sizeof(char)); return nBytesRead; } }; My problem right now it how to pass the outBuffer variable in the GetPacket method outside the class. If I let the variable being declared inside the function, it gets erase when the function ends and my data goes with it. If I declare that variable in the class itself, the compiler says the following: 'outBuffer' : must explicitly specify __gc or __nogc for an array declared in a managed type And if I put the __gc attribute on the variable, then the compiler tells the following: 'identifier' : '__gc' can only be applied to a class, struct, interface, array or pointer So... what do I have to do in order to make this variable available in the C# side? I'm using char, because I need a signed 8-bit value on each position of the array. Can anyone give me some lights here? Thanks, Nuno

    Managed C++/CLI csharp c++ data-structures help tutorial

  • USB interaction from user space. I need some light please!
    S sinosoidal

    Hi David, I made it! However it was a little hard to get the device name. But I made it! :) I have to try your suggestion to get the device name more genericly. In what regards to read from the device, I'm using readfile function which was what the test app was calling, because, otherwise, I didn't knew which IO_CTL codes to use in order to invoke the request! :) I'm still ambienting myself to the windows programming model. Your help crucial guys. Thank you very much, With my best regards, Nuno PS: you'll see me again here for sure! :D

    C / C++ / MFC csharp c++ help

  • USB interaction from user space. I need some light please!
    S sinosoidal

    Hi, Thanks for the replies. That was good news for me. I'm trying to explorer the direct connection to the USB device from C# using DeviceIOControl. I found an example with code from an article here in codeproject. The example, basicly interacts with an pci card, but i have seen another example of interaction, but this time with an usb device and they both start with CreateFile passing the device GUID. However, i cant have a valid handle. I think i'm passing the right guid of the device, because i'm getting it from the driver it self.

    hFileHandle = INVALID_HANDLE_VALUE;
    //open handle
    hFileHandle = CreateFile("{00873fdf-61a8-11d1-aa5e-00c04fb1728b}",
    GENERIC_READ |
    GENERIC_WRITE,
    0,
    (IntPtr)0,
    OPEN_EXISTING,
    0,
    NULL);

                if (hFileHandle == INVALID\_HANDLE\_VALUE)
                {
                    Console.WriteLine("Cannot open driver handle");
                    return;
                }
    

    Any tips? Thanks, Nuno

    C / C++ / MFC csharp c++ help

  • USB interaction from user space. I need some light please!
    S sinosoidal

    Hi, I'm developing a driver for a usb device. I have already a driver sample that allows me to get data from my device. And the sample code to interact with the device is a console application. I need to get that data into a C# program and now I don't know what to do. I can think in some options like: - Do this directly in the driver layer (which is a big puzzle) - Wrap the code of the sample app in a C++ dll which I can then use in the C# side (don't know which kind of project that belongs to) So, I was looking for some lights in order to see where I should focus my development efforts. Any help would be appreciatted. With my best regards, Nuno

    C / C++ / MFC csharp c++ help

  • Problems with treeview in WPF
    S sinosoidal

    Hi, I have made a custom class to populate a TreeView thru its ItemsSource. That class heritates ObservableCollection. The thing is that its nodes doesnt seem to be TreeViewItems because i cant apply code that works for normal treeviewitems. I'm talking about code to do right click select, etc. What i really want is to be able to automaticly select a node when i right click it, and then open the context menu. I can do this perfectly using the left button to select the node and then using the right click to access the context menu. The problem is that i cant use directly the right button which is something typical in windows enviorment. The code i'm using to achieve that is the following: Code Snippet tvNetworkExplorer.AddHandler(TreeViewItem.MouseDownEvent, new MouseButtonEventHandler(TvNetworkExplorer_MouseDown)); private void TvNetworkExplorer_MouseDown(object sender, MouseButtonEventArgs e) { TreeViewItem item = e.Source as TreeViewItem; if (e.RightButton == MouseButtonState.Pressed) { item.IsSelected = true; } } I think this happens because the items are not tree view items, as stated before, they are items from an observable collection of a custom type. How can i make such behaviour to happen? The problem is that even using the visual tree help i always get the first node. I need to show you the big picture. Maybe i have something really small failing: XAML:

    C# wpf help question csharp data-structures

  • How to serialize a class that has both of two worlds
    S sinosoidal

    hi, I want to serialize a class which has the two kinds of elements. Custom elements (non graphic and made by me, which are serializable by the XmlSerializer), and UI Elements from the WPF. The class which i want to serialize is this: Code Snippet public class Region : ISerializable { private Control _control; public Control Control { get { return _control; } set { _control = value; } } private Border _bounds; public Border Bounds { get { return _bounds; } set { _bounds = value; } } public Region() { } /// /// Initializes a new instance of the class. /// public Region(Border bounds) { _bounds = bounds; } public Region(SerializationInfo info, StreamingContext ctxt) { this._control = (Control)info.GetValue("Control", typeof(Control)); this._bounds = (Border)XamlReader.Load(new XmlTextReader(new StringReader((string)info.GetValue("Bounds", typeof(string))))); } public void GetObjectData(SerializationInfo info, StreamingContext ctxt) { info.AddValue("Control", this._control); info.AddValue("Bounds", XamlWriter.Save(_bounds)); } } As you can see, this class is composed by a Control (custom made class specified by me) and a Border (UI Element). The class was serializable if i didnt have the border on it. My attempt was to override the Iserialize methods in order to have serialization of the border based on XamlWriter.Save but it gives me error before getting there, in the following line: Code Snippet System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(Region)); With the message: Code Snippet "There was an error reflecting property 'Bounds'." How can i solve this problem? Thx, Nuno

    C# help question csharp wpf design

  • What is the purpose of suspend and resume layout? i cant see it working
    S sinosoidal

    Hi, For a long time that im trying to understand how resume/suspend layout works. I can't actually see any result of using those calls. I'm trying to avoid visual glitches caused for example by several repeated insertions in a treeview. but nothing happened. i also tried to used this calls when doing rezises to panels in realtime in order to avoid visual glitches as well. nothing happened... Can anyone give me a clear idea of how to use those calls? Thx, Nuno

    C# tutorial question career

  • WPF - How to show a webpage in a 3D surface
    S sinosoidal

    Hi, I am digging into WPF and i have found that the control used to display webpages (Frame) cant be used as a Visual Brush. How can i find a form of displaying webpages in a way that i then can use it as a visual brush in a 3D surface? Thx, Nuno

    .NET (Core and Framework) question csharp wpf tutorial

  • Cant i drag and drop between diferent forms?
    S sinosoidal

    Hi, I have a SDI application. I want to drag and drop between two components. One of them is in the SDI main form, and the second one is in the second form. Its seems that there is no reaction to the dragdrop event. Is there any trick to do it? Thx, Nuno

    C# question

  • Avoid trailing while dragging control
    S sinosoidal

    Hi, Thx for your reply. Can you point me an example? Thx, Nuno

    C# question

  • Avoid trailing while dragging control
    S sinosoidal

    Hi, I have implemented a control dragging system. Basicly i'm dragging panels inside a panel. The thing is that i decided to put an image in the main panel background. But that makes my other panels leave a trail when i drag them. Does anyone has an explanation/solution for this? Thx, Nuno

    C# question

  • Maximize glitches
    S sinosoidal

    Hi, I'm working on a app which workspace is contained in one splitcontainer that for its turn is also inside a splitcontainer. That workspace is a form and i told it to always maximize. If i want to make always maximized i told the splitcontainers to do the following operations when moved: if (workspace != null) { workspace.WindowState = FormWindowState.Normal; workspace.WindowState = FormWindowState.Maximized; } The thing is that i cant see a imediate adapation of the form. I can perfectly note is getting smallerand then getting bigger, occupiyng the full area. Is there a way of making this adaptation more smooth? Thx, Best regards, Nuno

    C# question workspace

  • Moving a control in runtime with c#, without using c++ api
    S sinosoidal

    Hi Martin, While i was waiting for an answer i kept trying. I got it! And it was pretty simple! New code: private void panel_MouseDown(object sender, MouseEventArgs e) { Panel region = (Panel)sender; xi = e.X; yi = e.Y; drag = true; } private void panel_MouseUp(object sender, MouseEventArgs e) { drag = false; } private void panel_MouseMove(object sender, MouseEventArgs e) { if (drag) { Panel region = (Panel)sender; region.Location = new Point((region.Left + (e.X - xi)), (region.Top + (e.Y - yi))); } } Basicly i think the problem is the diference between the coordinate system from the mouse and control Other thing i dont understand is how does suspend/resume layout works as they weren't doing a thing. Thx anyway, Nuno

    C# help csharp c++ json question

  • Moving a control in runtime with c#, without using c++ api
    S sinosoidal

    Hi, I'm trying to move a control while clicking on it. it works but very bad! When i click the control down (panel), and start moving it, it is continuosly swaping between two position and i cant find a reason for that behaviour. This is my code (only the event handlers): private void panel_MouseDown(object sender, MouseEventArgs e) { Console.WriteLine("mouse down"); Panel region = (Panel)sender; drag = true; } private void panel_MouseUp(object sender, MouseEventArgs e) { Console.WriteLine("mouse up"); drag = false; } private void panel_MouseMove(object sender, MouseEventArgs e) { if (drag) { this.SuspendLayout(); Panel region = (Panel)sender; region.Location = new Point(e.X, e.Y); Console.WriteLine("Panel position: (" + region.Left + "," + region.Top + ")" + "mouse position: (" + e.X + "," + e.Y + ")"); this.ResumeLayout(); } } Someone has given me an answer to this problem using user32.dll but i want to have more control of the thing. Can anyone help me? Thx Nuno

    C# help csharp c++ json 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