Search Results

Search found 391 results on 16 pages for 'hwnd'.

Page 6/16 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Winforms: Attempted to read or write protected memory. This is often an indication that other memory is corrupt

    - by mamcx
    I have a bunch of background events. All of them call a log: private void log(string text, params object[] values) { if (editLog.InvokeRequired) { editLog.BeginInvoke( (MethodInvoker)delegate { this.log(text, values); }); } else { text = string.Format(text, values) + Environment.NewLine; lock (editLog) { editLog.AppendText(text); editLog.SelectionStart = editLog.TextLength; editLog.ScrollToCaret(); } } } Sometimes I get this, but other times not: System.AccessViolationException was unhandled Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source=System.Windows.Forms StackTrace: at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.RichTextBox.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Object& editOle) at System.Windows.Forms.TextBoxBase.ScrollToCaret() at Program1.frmMain.log(String text, Object[] values) in ... ... ... P.D: Not always stop at this line, randomly will be one of the three times editLog methods/properties are used. Not always a exception is throw. Sometimes look like the thing freeze. But not the main UI, just the flow of messages (ie: log look like is never called again) The app is a single form, with background process. I can't see what I doing wrong with this...

    Read the article

  • Calling unmanaged dll from C#. Take 2

    - by Charles Gargent
    I have written a c# program that calls a c++ dll that echoes the commandline args to a file When the c++ is called using the rundll32 command it displays the commandline args no problem, however when it is called from within the c# it doesnt. I asked this question to try and solve my problem, but I have modified it my test environment and I think it is worth asking a new question. Here is the c++ dll #include "stdafx.h" #include "stdlib.h" #include <stdio.h> #include <iostream> #include <fstream> using namespace std; BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } extern "C" __declspec(dllexport) int WINAPI CMAKEX( HWND hwnd, HINSTANCE hinst, LPCSTR lpszCommandLine, DWORD dwReserved) { ofstream SaveFile("output.txt"); SaveFile << lpszCommandLine; SaveFile.close(); return 0; } Here is the c# app using System; using System.Collections.Generic; using System.Text; using System.Security.Cryptography; using System.Runtime.InteropServices; using System.Net; namespace nac { class Program { [DllImport("cmakca.dll", SetLastError = true, CharSet = CharSet.Unicode)] static extern bool CMAKEX(IntPtr hwnd, IntPtr hinst, string lpszCmdLine, int nCmdShow); static void Main(string[] args) { string cmdLine = @"/source_filename proxy-1.txt /backup_filename proxy.bak /DialRasEntry NULL /TunnelRasEntry DSLVPN /profile ""C:\Documents and Settings\Administrator\Application Data\Microsoft\Network\Connections\Cm\dslvpn.cmp"""; const int SW_SHOWNORMAL = 1; CMAKEX(IntPtr.Zero, IntPtr.Zero, cmdLine, SW_SHOWNORMAL).ToString(); } } } The output from the rundll32 command is rundll32 cmakex.dll,CMAKEX /source_filename proxy-1.txt /backup_filename proxy.bak /DialRasEntry NULL /TunnelRasEntry DSLVPN /profile ""C:\Documents and Settings\Administrator\Application Data\Microsoft\Network\Connections\Cm\dslvpn.cmp" /source_filename proxy-1.txt /backup_filename proxy.bak /DialRasEntry NULL /TunnelRasEntry DSLVPN /profile ""C:\Documents and Settings\Administrator\Application Data\Microsoft\Network\Connections\Cm\dslvpn.cmp" however the output when the c# app runs is /

    Read the article

  • Windows Messages Bizarreness

    - by jameszhao00
    Probably just a gross oversight of some sort, but I'm not receiving any WM_SIZE messages in the message loop. However, I do receive them in the WndProc. I thought the windows loop gave messages out to WndProc? LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { switch(message) { // this message is read when the window is closed case WM_DESTROY: { // close the application entirely PostQuitMessage(0); return 0; } break; case WM_SIZE: return 0; break; } printf("wndproc - %i\n", message); // Handle any messages the switch statement didn't return DefWindowProc (hWnd, message, wParam, lParam); } ... and now the message loop... while(TRUE) { // Check to see if any messages are waiting in the queue if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { // translate keystroke messages into the right format TranslateMessage(&msg); // send the message to the WindowProc function DispatchMessage(&msg); // check to see if it's time to quit if(msg.message == WM_QUIT) { break; } if(msg.message == WM_SIZING) { printf("loop - resizing...\n"); } } else { //do other stuff } }

    Read the article

  • Trying to Create a ToolBar with an ImageList, not working.

    - by blaquee
    Im trying to get my toolbar to work, with an imagelist. The images are png's and are individual So i was adding them in the ImageList in succession. But it wasnt working, Here is the code to add the Image to the ImageList HIMAGELIST CreateToolBarImages( HINSTANCE hInst) { HIMAGELIST v_ImageList = NULL; //IMAGE_LIST v_Img; HICON hIcon; HBITMAP hBit; COLORMAP cMap; COLORREF fromColor = RGB( 0,0,0 ); InitCommonControls(); v_ImageList = ImageList_Create( 32,32, ILC_MASK, 1,1 ); cMap.from = fromColor; cMap.to = ::GetSysColor ( COLOR_BTNFACE ); hBit = CreateMappedBitmap( hInst, IDB_CONSOLE, 0, &cMap, 1 ); //hBit = LoadBitmap( hInst, MAKEINTRESOURCE(IDB_CONSOLE) ); consoleImg = ImageList_Add( v_ImageList, hBit, 0 ); if( consoleImg == -1 ) return NULL; DeleteObject( hBit ); Then i create The ToolBar, but it fails at the Image function. HWND CreateToolBarButton( HWND hWndParent ) { const int ImageID = 0; const int numB = 1; COLORREF iColor; HWND hToolBar = CreateWindowEx( 0, TOOLBARCLASSNAME, NULL, WS_CHILD |TBSTYLE_LIST |TBSTYLE_FLAT | WS_VISIBLE, 0,0,0,0, hWndParent, NULL, g_hInst, NULL ); if( hToolBar == NULL ) return NULL; HIMAGELIST ImgList = CreateToolBarImages ( g_hInst); if( ImgList == NULL ) MessageBox( hWndParent, L"No Tool Images", L"BOB", MB_OK ); return NULL; Is there something im missing? or not doing?

    Read the article

  • Using SHFileOperation: What errors are occuring

    - by Sascha
    Hello I am using the function SHFileOperation() to send a file to the recycling bin. And I am getting 2 errors that I do not know what they mean because with this function the error codes are not GetLastError() values. Now when the function SHFileOperation() fails the return values are 0x57 (decimal 87) & 0x2 (decimal 2). Can you help me discover the definitions of these errors (expecially when you consider with this function, the errors are not part of the GetLastError() codes). Some important information: • I am using Windows 7 (& I know that MSDN says to use IFileOperation instead of SHFileOperation but I want to make my app backwards compatable which is why I am using SHFileOperation). If the error is occuring because I am using SHFileOperation on Windows 7 what solution could I use to make this work on all versions of windows from 2000 & up? • I have debugged extensively & as far as I know my SHFILEOPSTRUCT is correct (correct flags used, .pFrom is a double-null ended string). One thing I know for sure is that my path to the file is correct (leads to a real file & it correctly formatted). • About 2/5 times the SHFileOperation() works, meaning it sends the file to the recycle bin & does not returns an error BOOL result; SHFILEOPSTRUCT fileStruct; fileStruct.hwnd = hwnd; fileStruct.wFunc = FO_DELETE; fileStruct.pFrom = dest.c_str(); fileStruct.fFlags = FOF_FILESONLY; // FOF_ALLOWUNDO fileStruct.fAnyOperationsAborted = result; // Call operation(delete file) int success = SHFileOperation( &fileStruct ); // if delete was successful if ( success != 0 ) { printf( "%s \t %X %d \n", dest.c_str(), success, success ); cout << result << endl; MessageBox( hwnd, "Failed to delete file", "Error", MB_OK|MB_ICONERROR ); return; }

    Read the article

  • WM_NOTIFY and superclass chaining issue in Win32

    - by DasMonkeyman
    For reference I'm using the window superclass method outlined in this article. The specific issue occurs if I want to handle WM_NOTIFY messages (i.e. for custom drawing) from the base control in the superclass I either need to reflect them back from the parent window or set my own window as the parent (passed inside CREATESTRUCT for WM_(NC)CREATE to the base class). This method works fine if I have a single superclass. If I superclass my superclass then I run into a problem. Now 3 WindowProcs are operating in the same HWND, and when I reflect WM_NOTIFY messages (or have them sent to myself from the parent trick above) they always go to the outermost (most derived) WindowProc. I have no way to tell if they're messages intended for the inner superclass (base messages are supposed to go to the first superclass) or messages intended for the outer superclass (messages from the inner superclass are intended for the outer superclass). These messages are indistinguishable because they all come from the same HWND with the same control ID. Is there any way to resolve this without creating a new window to encapsulate each level of inheritance? Sorry about the wall of text. It's a difficult concept to explain. Here's a diagram. single superclass: SuperA::WindowProc() - Base::WindowProc()---\ ^--------WM_NOTIFY(Base)--------/ superclass of a superclass: SuperB::WindowProc() - SuperA::WindowProc() - Base::WindowProc()---\ ^--------WM_NOTIFY(Base)--------+-----------------------/ ^--------WM_NOTIFY(A)-----------/ The WM_NOTIFY messages in the second case all come from the same HWND and control ID, so I cannot distinguish between the messages intended for SuperA (from Base) and messages intended for SuperB (from SuperA). Any ideas?

    Read the article

  • error C2146: syntax error : missing ';' before identifier 'g_App'

    - by numerical25
    I wish c++, was a little more specific on the messages they give. The following error is being thrown in the document below main.h #ifndef main_h #define main_h //includes #include <windows.h> #include <commctrl.h> #include <d3d9.h> #include <fstream> #include "capplication.h" //constants #define TITLE "D3D Tut 01: Create Window" #define WINDOW_X 350 #define WINDOW_Y 320 //Button ID's #define ID_START 1 #define ID_CANCEL 2 //globals extern CApplication g_App; //function prototypes LRESULT CALLBACK WindowProcedure(HWND,UINT,WPARAM,LPARAM); #endif The only header file that could possible throw this error is the capplication.h. given below capplication.h #ifndef capplication_h #define capplication_h #include"main.h" class CApplication { public: CApplication(void); ~CApplication(void); void InitWindow(void); void SaveSettings(void); void LoadSettings(void); void KillWindow(void); inline bool GetWindowStatus(void) { return m_bRunningWindow; } inline HWND GetWindowHandle(void) { return m_hWindow; } inline void SetWindowStatus(bool bRunningWindow) { m_bRunningWindow = bRunningWindow; } private: bool m_bRunningWindow; HWND m_hWindow, m_hBtnStart, m_hBtnCancel, m_hLblResolution, m_hCbResolution, m_hLblBackBuffer, m_hCbBackBuffer, m_hLblDepthStencil, m_hCbDepthStencil, m_hLblVertexProcessing, m_hCbVertexProcessing, m_hLblMultiSampling, m_hCbMultiSampling, m_hLblAnisotropy, m_hCbAnisotropy; DWORD m_dwWidth, m_dwHeight, m_dwVertexProcessing, m_dwAnisotropy; D3DFORMAT m_ColorFormat, m_DepthStencilFormat; D3DMULTISAMPLE_TYPE m_MultiSampling; }; #endif Besides that, the only suspicious thing I see is fstream given in the first code. I did have it as fstream.h But VC++ was not recognizing it so I was told to remove the h and I did. now I am down to this error. and I have no clue what it could be. Possibly something obvious

    Read the article

  • How to handle Win+Shift+LEft/Right on Win7 with custom WM_GETMINMAXINFO logic?

    - by Steven Robbins
    I have a custom windows implementation in a WPF app that hooks WM_GETMINMAXINFO as follows: private void MaximiseWithTaskbar(System.IntPtr hwnd, System.IntPtr lParam) { MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO)); System.IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); if (monitor != System.IntPtr.Zero) { MONITORINFO monitorInfo = new MONITORINFO(); GetMonitorInfo(monitor, monitorInfo); RECT rcWorkArea = monitorInfo.rcWork; RECT rcMonitorArea = monitorInfo.rcMonitor; mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left); mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top); mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left); mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top); mmi.ptMinTrackSize.x = Convert.ToInt16(this.MinWidth * (desktopDpiX / 96)); mmi.ptMinTrackSize.y = Convert.ToInt16(this.MinHeight * (desktopDpiY / 96)); } Marshal.StructureToPtr(mmi, lParam, true); } It all works a treat and it allows me to have a borderless window maximized without having it sit on to of the task bar, which is great, but it really doesn't like being moved between monitors with the new Win7 keyboard shortcuts. Whenever the app is moved with Win+Shift+Left/Right the WM_GETMINMAXINFO message is received, as I'd expect, but MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST) returns the monitor the application has just been moved FROM, rather than the monitor it is moving TO, so if the monitors are of differing resolutions the window end up the wrong size. I'm not sure if there's something else I can call, other then MonitorFromWindow, or whether there's a "moving monitors" message I can hook prior to WM_GETMINMAXINFO. I'm assuming there is a way to do it because "normal" windows work just fine.

    Read the article

  • Read data from form

    - by Superhuman
    This is a strange question, I've never tried to do this before. I have a repetitive process requiring that I copy and paste data from text boxes in one program into another program for further processing. I'd like to automate this process using VB .NET. The application from which the data is gathered isn't mine, so I don't have ActiveX-like access to its controls. How would you write an application to gain access to a form from another application, to be able to find the controls on the form, and gather the values from them? Just experimenting, I've used the following code. This resulted in only the name of the form to which this code belongs. It didn't find the names of any other forms I have open, and I have a lot open to choose from. This is frustrating because it's only step one of what I'll need to do to make my life easier... Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As CallBack, ByVal lParam As Integer) As Integer Public Delegate Function CallBack(ByVal hwnd As IntPtr, ByVal lParam As IntPtr) As Boolean Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cb As New CallBack(AddressOf MyCallBack) EnumWindows(cb, 8) End Sub Public Function MyCallBack(ByVal hwnd As Long, ByVal lparam As Long) As Boolean Dim frm As System.Windows.Forms.Control frm = System.Windows.Forms.Form.FromHandle(hwnd) If frm Is Nothing Then Return True If frm.Text <> "" Then TextBox1.Text += frm.Text & ", " End If Return True End Function Does anyone have a recommendation? Thanks, SH

    Read the article

  • About the MSDN NOTIFYICONDATA's cbSize member

    - by KenC
    Hi, I am reading the NOTIFYICONDATA documentation in MSDN. It says the NOTIFYICONDATA structure has a cbSize member should be set to the size of the structure, but NOTIFYICONDATA structure's size has different size in every Shell32.dll, so you should get the Shell32.dll version before setting cbSize. The following quotes from MSDN: If it is version 5.0 or later, initialize the cbSize member as follows. nid.cbSize = sizeof(NOTIFYICONDATA); Setting cbSize to this value enables all the version 5.0 and 6.0 enhancements. For earlier versions, the size of the pre-6.0 structure is given by the NOTIFYICONDATA_V2_SIZE constant and the pre-5.0 structure is given by the NOTIFYICONDATA_V1_SIZE constant. Initialize the cbSize member as follows. nid.cbSize = NOTIFYICONDATA_V2_SIZE; Using this value for cbSize will allow your application to use NOTIFYICONDATA with earlier Shell32.dll versions, although without the version 6.0 enhancements. I found it a bit of vague, because 'sizeof(NOTIFYICONDATA)' has different value in Win98 (using Shell32.dll version 4.x), Win2K (version 5.0) and WinXP (version 6.0). How could it 'enable all version 5.0 and 6.0 enhancements'? So I looked for the definition of NOTIFYICONDATA_V1_SIZE (source code as below), I see: NOTIFYICONDATA_V1_SIZE is for Win 2K (doesn't include 2K) NOTIFYICONDATA_V2_SIZE is for Win XP NOTIFYICONDATA_V3_SIZE is for Vista (not sure if I am right) It's completely different from what MSDN says? and none for Win2K? So, I am totaly confused right now. How should I set the cbSize member according to Shell32.dll version? Could anybody help me... Thanks in advance. //= = = = = = = = ShellAPI.h = = = = = = = = typedef struct _NOTIFYICONDATAA { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; #if (NTDDI_VERSION < NTDDI_WIN2K) CHAR szTip[64]; #endif #if (NTDDI_VERSION >= NTDDI_WIN2K) CHAR szTip[128]; DWORD dwState; DWORD dwStateMask; CHAR szInfo[256]; union { UINT uTimeout; UINT uVersion; // used with NIM_SETVERSION, values 0, 3 and 4 } DUMMYUNIONNAME; CHAR szInfoTitle[64]; DWORD dwInfoFlags; #endif #if (NTDDI_VERSION >= NTDDI_WINXP) GUID guidItem; #endif #if (NTDDI_VERSION >= NTDDI_VISTA) HICON hBalloonIcon; #endif } NOTIFYICONDATAA, *PNOTIFYICONDATAA; typedef struct _NOTIFYICONDATAW { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; #if (NTDDI_VERSION < NTDDI_WIN2K) WCHAR szTip[64]; #endif #if (NTDDI_VERSION >= NTDDI_WIN2K) WCHAR szTip[128]; DWORD dwState; DWORD dwStateMask; WCHAR szInfo[256]; union { UINT uTimeout; UINT uVersion; // used with NIM_SETVERSION, values 0, 3 and 4 } DUMMYUNIONNAME; WCHAR szInfoTitle[64]; DWORD dwInfoFlags; #endif #if (NTDDI_VERSION >= NTDDI_WINXP) GUID guidItem; #endif #if (NTDDI_VERSION >= NTDDI_VISTA) HICON hBalloonIcon; #endif } NOTIFYICONDATAW, *PNOTIFYICONDATAW; #define NOTIFYICONDATAA_V1_SIZE FIELD_OFFSET(NOTIFYICONDATAA, szTip[64]) #define NOTIFYICONDATAW_V1_SIZE FIELD_OFFSET(NOTIFYICONDATAW, szTip[64]) #ifdef UNICODE #define NOTIFYICONDATA_V1_SIZE NOTIFYICONDATAW_V1_SIZE #else #define NOTIFYICONDATA_V1_SIZE NOTIFYICONDATAA_V1_SIZE #endif #define NOTIFYICONDATAA_V2_SIZE FIELD_OFFSET(NOTIFYICONDATAA, guidItem) #define NOTIFYICONDATAW_V2_SIZE FIELD_OFFSET(NOTIFYICONDATAW, guidItem) #ifdef UNICODE #define NOTIFYICONDATA_V2_SIZE NOTIFYICONDATAW_V2_SIZE #else #define NOTIFYICONDATA_V2_SIZE NOTIFYICONDATAA_V2_SIZE #endif #define NOTIFYICONDATAA_V3_SIZE FIELD_OFFSET(NOTIFYICONDATAA, hBalloonIcon) #define NOTIFYICONDATAW_V3_SIZE FIELD_OFFSET(NOTIFYICONDATAW, hBalloonIcon) #ifdef UNICODE #define NOTIFYICONDATA_V3_SIZE NOTIFYICONDATAW_V3_SIZE #else #define NOTIFYICONDATA_V3_SIZE NOTIFYICONDATAA_V3_SIZE #endif (Seems like the code doesn't look good on the web site, but it from ShellAPI.h, all the same)

    Read the article

  • c# SendMessage and Skype woes

    - by Xcelled194
    I'm trying to create an add-on to Skype with C#. I don't want to use Skype4COM, as I'd like the experience with messages and such. Unfortunately, the messages are tripping me up. I've got the pumps and such set up. They all work, and my app successfully sends the "APIDiscover" message to Skype, gets a "PendingAuth" response and then the "AttachSuccess" message. However, when I try to send "ping" to Skype (to which it should reply "pong") nothing happens. The return code from SendMessage is 0 but Marshall.GetLastWin32Error is 1400 (Invalid handle). The handle was returned with the AttachSuccess method. The equivalent C++ code does work, so I'm at a loss. First is the C++ code I'm using as a guide: Here's the (cut down) message pump. You can ignore everything but where I put the //<---- static LRESULT APIENTRY SkypeAPITest_Windows_WindowProc( HWND hWindow, UINT uiMessage, WPARAM uiParam, LPARAM ulParam) { LRESULT lReturnCode; bool fIssueDefProc; lReturnCode=0; fIssueDefProc=false; switch(uiMessage) { case WM_COPYDATA: if( hGlobal_SkypeAPIWindowHandle==(HWND)uiParam ) { PCOPYDATASTRUCT poCopyData=(PCOPYDATASTRUCT)ulParam; printf( "Message from Skype(%u): %.*s\n", poCopyData->dwData, poCopyData->cbData, poCopyData->lpData); lReturnCode=1; } break; default: if( uiMessage==uiGlobal_MsgID_SkypeControlAPIAttach ) { switch(ulParam) { case SKYPECONTROLAPI_ATTACH_SUCCESS: printf("!!! Connected; to terminate issue #disconnect\n"); hGlobal_SkypeAPIWindowHandle=(HWND)uiParam;//<---- Right here is where we receive the handle from Skype. break; } if( fIssueDefProc ) lReturnCode=DefWindowProc( hWindow, uiMessage, uiParam, ulParam); return(lReturnCode); } and this is the (again dumbed down) "sending message" code void __cdecl Global_InputProcessingThread(void *) { static char acInputRow[1024]; bool fProcessed; if( SendMessageTimeout( HWND_BROADCAST, uiGlobal_MsgID_SkypeControlAPIDiscover, (WPARAM)hInit_MainWindowHandle, 0, SMTO_ABORTIFHUNG, 1000, NULL)!=0 ) { while(Global_Console_ReadRow( acInputRow, sizeof(acInputRow)-1)) { if( fProcessed==false && hGlobal_SkypeAPIWindowHandle!=NULL ) { COPYDATASTRUCT oCopyData; // send command to skype oCopyData.dwData=0; oCopyData.lpData=acInputRow; oCopyData.cbData=strlen(acInputRow)+1; if( oCopyData.cbData!=1 ) { if( SendMessage( hGlobal_SkypeAPIWindowHandle, WM_COPYDATA, (WPARAM)hInit_MainWindowHandle, (LPARAM)&oCopyData)==FALSE ) { hGlobal_SkypeAPIWindowHandle=NULL; printf("!!! Disconnected\n"); } } } } } SendMessage( hInit_MainWindowHandle, WM_CLOSE, 0, 0); SetEvent(hGlobal_ThreadShutdownEvent); fGlobal_ThreadRunning=false; } And now here's my C# public bool PreFilterMessage(ref Message m) { Console.WriteLine(m.ToString()); if (m.Msg == WM_COPYDATA && SkypeAPIWindowHandle == m.WParam) { SkypeMessage(m); return true; } if (m.Msg == MsgApiAttach) { switch (m.LParam.ToInt32()) { case (int)SkypeControlAPIAttach.SUCCESS: SkypeAPIWindowHandle = m.WParam; //Here's where we set the Skype Handle AttachSuccess(m); return true; } } return false; //Defer all other messages } And here is my DLL import and Sending code [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] static extern IntPtr SendMessageA(IntPtr hWnd, UInt32 Msg, IntPtr wParam, ref MsgHelper.COPYDATASTRUCT lParam); public static void Command(string c) { if (c.Last() != '\0') c += "\0"; //Make string null terminated Console.WriteLine(); MsgHelper.COPYDATASTRUCT cda = new MsgHelper.COPYDATASTRUCT(); cda.dwData = new IntPtr(0); cda.lpData = c; cda.cbData = c.Length + 1; Marshal.GetLastWin32Error(); //Clear last error Console.WriteLine(SendMessageA(mHelper.SkypeAPIWindowHandle, MsgHelper.WM_COPYDATA, IntPtr.Zero, ref cda)); Console.WriteLine(Marshal.GetLastWin32Error()); } COPYDATASTRUCT is: public struct COPYDATASTRUCT { public IntPtr dwData; public int cbData; [MarshalAs(UnmanagedType.LPStr)] public string lpData; } I think that's everything. Let me know if I forgot something. Any ideas why I'm getting the 1400?

    Read the article

  • How can I properly implement inetcpl.cpl as an external dll?

    - by Kyt
    I have the following 2 sets of code, both of which produce the same results: using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ResetIE { class Program { [DllImport("InetCpl.cpl", SetLastError=true, CharSet=CharSet.Unicode, EntryPoint="ClearMyTracksByProcessW")] public static extern long ClearMyTracksByProcess(IntPtr hwnd, IntPtr hinst, ref TargetHistory lpszCmdLine, FormWindowState nCmdShow); static void Main(string[] args) { TargetHistory th = TargetHistory.CLEAR_TEMPORARY_INTERNET_FILES; ClearMyTracksByProcessW(Process.GetCurrentProcess().Handle, Marshal.GetHINSTANCE(typeof(Program).Module), ref th, FormWindowState.Maximized); Console.WriteLine("Done."); } } and ... static class NativeMethods { [DllImport("kernel32.dll")] public static extern IntPtr LoadLibrary(string dllToLoad); [DllImport("kernel32.dll")] public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName); [DllImport("kernel32.dll")] public static extern bool FreeLibrary(IntPtr hModule); } public class CallExternalDLL { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate long ClearMyTracksByProcessW(IntPtr hwnd, IntPtr hinst, ref TargetHistory lpszCmdLine, FormWindowState nCmdShow); public static void Clear_IE_Cache() { IntPtr pDll = NativeMethods.LoadLibrary(@"C:\Windows\System32\inetcpl.cpl"); if (pDll == IntPtr.Zero) { Console.WriteLine("An Error has Occurred."); } IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "ClearMyTracksByProcessW"); if (pAddressOfFunctionToCall == IntPtr.Zero) { Console.WriteLine("Function Not Found."); } ClearMyTracksByProcessW cmtbp = (ClearMyTracksByProcessW)Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(ClearMyTracksByProcessW)); TargetHistory q = TargetHistory.CLEAR_TEMPORARY_INTERNET_FILES; long result = cmtbp(Process.GetCurrentProcess().Handle, Marshal.GetHINSTANCE(typeof(ClearMyTracksByProcessW).Module), ref q, FormWindowState.Normal); } } both use the following Enum: public enum TargetHistory { CLEAR_ALL = 0xFF, CLEAR_ALL_WITH_ADDONS = 0x10FF, CLEAR_HISTORY = 0x1, CLEAR_COOKIES = 0x2, CLEAR_TEMPORARY_INTERNET_FILES = 0x8, CLEAR_FORM_DATA = 0x10, CLEAR_PASSWORDS = 0x20 } Both methods of doing this compile and run just fine, offering no errors, but both churn endlessly never returning from their work. The PInvoke code was ported from the following VB, which was fairly difficult to track down: Option Explicit Private Enum TargetHistory CLEAR_ALL = &HFF& CLEAR_ALL_WITH_ADDONS = &H10FF& CLEAR_HISTORY = &H1& CLEAR_COOKIES = &H2& CLEAR_TEMPORARY_INTERNET_FILES = &H8& CLEAR_FORM_DATA = &H10& CLEAR_PASSWORDS = &H20& End Enum Private Declare Function ClearMyTracksByProcessW Lib "InetCpl.cpl" _ (ByVal hwnd As OLE_HANDLE, _ ByVal hinst As OLE_HANDLE, _ ByRef lpszCmdLine As Byte, _ ByVal nCmdShow As VbAppWinStyle) As Long Private Sub Command1_Click() Dim b() As Byte Dim o As OptionButton For Each o In Option1 If o.Value Then b = o.Tag ClearMyTracksByProcessW Me.hwnd, App.hInstance, b(0), vbNormalFocus Exit For End If Next End Sub Private Sub Form_Load() Command1.Caption = "??" Option1(0).Caption = "?????????????" Option1(0).Tag = CStr(CLEAR_TEMPORARY_INTERNET_FILES) Option1(1).Caption = "Cookie" Option1(1).Tag = CStr(CLEAR_COOKIES) Option1(2).Caption = "??" Option1(2).Tag = CStr(CLEAR_HISTORY) Option1(3).Caption = "???? ???" Option1(3).Tag = CStr(CLEAR_HISTORY) Option1(4).Caption = "?????" Option1(4).Tag = CStr(CLEAR_PASSWORDS) Option1(5).Caption = "?????" Option1(5).Tag = CStr(CLEAR_ALL) Option1(2).Value = True End Sub The question is simply what am I doing wrong? I need to clear the internet cache, and would prefer to use this method as I know it does what I want it to when it works (rundll32 inetcpl.cpl,ClearMyTracksByProcess 8 works fine). I've tried running both as normal user and admin to no avail. This project is written using C# in VS2012 and compiled against .NET3.5 (must remain at 3.5 due to client restrictions)

    Read the article

  • VMRMixerControl9 & GDI problem!

    - by freefallr
    I'm attempting to overlay a bitmap on some video. I create a bitmap in memory, then I call SelectObject to select it into a memoryDC, so I can perform a DrawText operation on it. I'm not getting any results on screen at all - can anyone suggest why? thanks HRESULT MyGraph::MixTextOverVMR9(LPCTSTR szText) { // create a bitmap object using GDI, render the text to it accordingly // then Sets the bitmap as an alpha bitmap to the VMR9, so that it can be overlayed. HRESULT hr = S_OK; CBitmap bmpMem; CFont font; LOGFONT logicfont; CRect rcText; CRect rcVideo; VMR9AlphaBitmap alphaBmp; HWND hWnd = this->GetFirstRendererWindow(); COLORREF clrText = RGB(255, 255, 0); COLORREF clrBlack = RGB(0,0,0); HDC hdcHwnd = NULL; CDC dcMem; LONG lWidth; LONG lHeight; if( ! m_spVideoRenderer.p ) return E_NOINTERFACE; if( !m_spWindowlessCtrl.p ) return E_NOINTERFACE; if( ! m_spIMixerBmp9.p ) { m_spIMixerBmp9 = m_spVideoRenderer; if( ! m_spIMixerBmp9.p ) return E_NOINTERFACE; } // create the font.. LPCTSTR sFont = _T("Times New Roman"); memset(&logicfont, 0, sizeof(LOGFONT)); logicfont.lfHeight = 42; logicfont.lfWidth = 20; logicfont.lfStrikeOut = 0; logicfont.lfUnderline = 0; logicfont.lfItalic = FALSE; logicfont.lfWeight = FW_NORMAL; logicfont.lfEscapement = 0; logicfont.lfCharSet = ANSI_CHARSET; logicfont.lfQuality = ANTIALIASED_QUALITY; logicfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; wcscpy_s( &logicfont.lfFaceName[0], wcslen(sFont)*2, sFont ); font.CreateFontIndirectW(&logicfont); // create a compatible memDC from the video window's HDC if( hWnd == NULL ) return E_FAIL; hdcHwnd = GetDC(hWnd); dcMem = CreateCompatibleDC(hdcHwnd); // get the required bitmap metrics from the MediaBuffer if( ! SUCCEEDED(m_spWindowlessCtrl->GetNativeVideoSize(&lWidth, &lHeight, NULL, NULL)) ) return E_FAIL; // create a bitmap for the text bmpMem.CreateCompatibleBitmap(dcMem.m_hDC, lWidth, lHeight); SelectBitmap (dcMem.m_hDC, bmpMem); SetBkMode (dcMem.m_hDC, TRANSPARENT); SetTextColor (dcMem.m_hDC, clrText); SelectFont (dcMem.m_hDC, font.m_hFont); // draw the text DrawTextW(dcMem.m_hDC, szText, wcslen(szText), rcText, DT_CALCRECT | DT_NOPREFIX ); DrawTextW(dcMem.m_hDC, szText, wcslen(szText), rcText, DT_NOPREFIX ); // Set the alpha bitmap on the VMR9 renderer memset(&alphaBmp, 0, sizeof(VMR9AlphaBitmap)); alphaBmp.rDest.left = 0; alphaBmp.rDest.top = 0.5; alphaBmp.rDest.right = 0.5; alphaBmp.rDest.bottom = 1; alphaBmp.dwFlags = VMR9AlphaBitmap_hDC; alphaBmp.hdc = dcMem.m_hDC; alphaBmp.pDDS = NULL; alphaBmp.rSrc = rcText; // rect to copy from the source image alphaBmp.fAlpha = 0.5f; // transparency value (1.0 is opaque, 0.0 is transparent) alphaBmp.clrSrcKey = clrText; // alphaBmp.dwFilterMode = MixerPref9_AnisotropicFiltering; hr = m_spIMixerBmp9->SetAlphaBitmap(&alphaBmp); DeleteDC(hdcHwnd); dcMem.DeleteDC(); bmpMem.DeleteObject(); font.DeleteObject(); return hr; }

    Read the article

  • A RenderTargetView cannot be created from a NULL Resource

    - by numerical25
    I am trying to create my render target view but I get this error from direct X A RenderTargetView cannot be created from a NULL Resource To my knowledge it seems that I must fill the rendertarget pointer with data before passing it. But I am having trouble figure out how. Below is my declaration and implementation declaration #pragma once #include "stdafx.h" #include "resource.h" #include "d3d10.h" #include "d3dx10.h" #include "dinput.h" #define MAX_LOADSTRING 100 class RenderEngine { protected: RECT m_screenRect; //direct3d Members ID3D10Device *m_pDevice; // The IDirect3DDevice10 // interface ID3D10Texture2D *m_pBackBuffer; // Pointer to the back buffer ID3D10RenderTargetView *m_pRenderTargetView; // Pointer to render target view IDXGISwapChain *m_pSwapChain; // Pointer to the swap chain RECT m_rcScreenRect; // The dimensions of the screen ID3DX10Font *m_pFont; // The font used for rendering text // Sprites used to hold font characters ID3DX10Sprite *m_pFontSprite; ATOM RegisterEngineClass(); void Present(); public: static HINSTANCE m_hInst; HWND m_hWnd; int m_nCmdShow; TCHAR m_szTitle[MAX_LOADSTRING]; // The title bar text TCHAR m_szWindowClass[MAX_LOADSTRING]; // the main window class name void DrawTextString(int x, int y, D3DXCOLOR color, const TCHAR *strOutput); //static functions static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); static INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); bool InitWindow(); bool InitDirectX(); bool InitInstance(); int Run(); RenderEngine() { m_screenRect.right = 800; m_screenRect.bottom = 600; } }; my implementation bool RenderEngine::InitDirectX() { //potential error. You did not set to zero memory and you did not set the scaling property DXGI_MODE_DESC bd; bd.Width = m_screenRect.right; bd.Height = m_screenRect.bottom; bd.Format = DXGI_FORMAT_R8G8B8A8_UNORM; bd.RefreshRate.Numerator = 60; bd.RefreshRate.Denominator = 1; DXGI_SAMPLE_DESC sd; sd.Count = 1; sd.Quality = 0; DXGI_SWAP_CHAIN_DESC swapDesc; ZeroMemory(&swapDesc, sizeof(swapDesc)); swapDesc.BufferDesc = bd; swapDesc.SampleDesc = sd; swapDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapDesc.OutputWindow = m_hWnd; swapDesc.BufferCount = 1; swapDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD, swapDesc.Windowed = true; swapDesc.Flags = 0; HRESULT hr; hr = D3D10CreateDeviceAndSwapChain(NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, D3D10_CREATE_DEVICE_DEBUG, D3D10_SDK_VERSION , &swapDesc, &m_pSwapChain, &m_pDevice); if(FAILED(hr)) return false; // Create a render target view hr = m_pDevice->CreateRenderTargetView( m_pBackBuffer, NULL, &m_pRenderTargetView); // FAILS RIGHT HERE // if(FAILED(hr)) return false; return true; }

    Read the article

  • About the MSDN Documentation on NOTIFYICONDATA's cbSize member

    - by KenC
    I am reading the NOTIFYICONDATA documentation in MSDN. It says the NOTIFYICONDATA structure has a cbSize member should be set to the size of the structure, but NOTIFYICONDATA structure's size has different size in every Shell32.dll, so you should get the Shell32.dll version before setting cbSize. The following quotes from MSDN: If it is version 5.0 or later, initialize the cbSize member as follows. nid.cbSize = sizeof(NOTIFYICONDATA); Setting cbSize to this value enables all the version 5.0 and 6.0 enhancements. For earlier versions, the size of the pre-6.0 structure is given by the NOTIFYICONDATA_V2_SIZE constant and the pre-5.0 structure is given by the NOTIFYICONDATA_V1_SIZE constant. Initialize the cbSize member as follows. nid.cbSize = NOTIFYICONDATA_V2_SIZE; Using this value for cbSize will allow your application to use NOTIFYICONDATA with earlier Shell32.dll versions, although without the version 6.0 enhancements. I found it a bit of vague, because 'sizeof(NOTIFYICONDATA)' has different value in Win98 (using Shell32.dll version 4.x), Win2K (version 5.0) and WinXP (version 6.0). How could it 'enable all version 5.0 and 6.0 enhancements'? So I looked for the definition of NOTIFYICONDATA_V1_SIZE (source code as below), I see: NOTIFYICONDATA_V1_SIZE is for Win 2K (doesn't include 2K) NOTIFYICONDATA_V2_SIZE is for Win XP NOTIFYICONDATA_V3_SIZE is for Vista (not sure if I am right) It's completely different from what MSDN says? and none for Win2K? So, I am totally confused right now. How should I set the cbSize member according to Shell32.dll version? //= = = = = = = = ShellAPI.h = = = = = = = = typedef struct _NOTIFYICONDATAA { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; #if (NTDDI_VERSION < NTDDI_WIN2K) CHAR szTip[64]; #endif #if (NTDDI_VERSION >= NTDDI_WIN2K) CHAR szTip[128]; DWORD dwState; DWORD dwStateMask; CHAR szInfo[256]; union { UINT uTimeout; UINT uVersion; // used with NIM_SETVERSION, values 0, 3 and 4 } DUMMYUNIONNAME; CHAR szInfoTitle[64]; DWORD dwInfoFlags; #endif #if (NTDDI_VERSION >= NTDDI_WINXP) GUID guidItem; #endif #if (NTDDI_VERSION >= NTDDI_VISTA) HICON hBalloonIcon; #endif } NOTIFYICONDATAA, *PNOTIFYICONDATAA; typedef struct _NOTIFYICONDATAW { DWORD cbSize; HWND hWnd; UINT uID; UINT uFlags; UINT uCallbackMessage; HICON hIcon; #if (NTDDI_VERSION < NTDDI_WIN2K) WCHAR szTip[64]; #endif #if (NTDDI_VERSION >= NTDDI_WIN2K) WCHAR szTip[128]; DWORD dwState; DWORD dwStateMask; WCHAR szInfo[256]; union { UINT uTimeout; UINT uVersion; // used with NIM_SETVERSION, values 0, 3 and 4 } DUMMYUNIONNAME; WCHAR szInfoTitle[64]; DWORD dwInfoFlags; #endif #if (NTDDI_VERSION >= NTDDI_WINXP) GUID guidItem; #endif #if (NTDDI_VERSION >= NTDDI_VISTA) HICON hBalloonIcon; #endif } NOTIFYICONDATAW, *PNOTIFYICONDATAW; #define NOTIFYICONDATAA_V1_SIZE FIELD_OFFSET(NOTIFYICONDATAA, szTip[64]) #define NOTIFYICONDATAW_V1_SIZE FIELD_OFFSET(NOTIFYICONDATAW, szTip[64]) #ifdef UNICODE #define NOTIFYICONDATA_V1_SIZE NOTIFYICONDATAW_V1_SIZE #else #define NOTIFYICONDATA_V1_SIZE NOTIFYICONDATAA_V1_SIZE #endif #define NOTIFYICONDATAA_V2_SIZE FIELD_OFFSET(NOTIFYICONDATAA, guidItem) #define NOTIFYICONDATAW_V2_SIZE FIELD_OFFSET(NOTIFYICONDATAW, guidItem) #ifdef UNICODE #define NOTIFYICONDATA_V2_SIZE NOTIFYICONDATAW_V2_SIZE #else #define NOTIFYICONDATA_V2_SIZE NOTIFYICONDATAA_V2_SIZE #endif #define NOTIFYICONDATAA_V3_SIZE FIELD_OFFSET(NOTIFYICONDATAA, hBalloonIcon) #define NOTIFYICONDATAW_V3_SIZE FIELD_OFFSET(NOTIFYICONDATAW, hBalloonIcon) #ifdef UNICODE #define NOTIFYICONDATA_V3_SIZE NOTIFYICONDATAW_V3_SIZE #else #define NOTIFYICONDATA_V3_SIZE NOTIFYICONDATAA_V3_SIZE #endif (Seems like the code doesn't look good on the web site, but it from ShellAPI.h, all the same)

    Read the article

  • Why can't my program display this dialog box, while another program can?

    - by nonoitall
    I'm trying to write a wrapper for Winamp input plugins and have hit a bit of a snag. I'd like my wrapper to be able to display a plugin's configuration dialog, which is (or should be) achieved by calling the plugin's Config(HWND hwndParent) function. For most plugins, this works fine and my program is able to display the plugin's configuration dialog. However, 64th Note (a plugin for playing USF files) is giving me problems. Winamp can display its configuration dialog just fine, but whenever I try to display it from my wrapper, the dialog gets destroyed before it ever shows itself. Thankfully, 64th Note is open source, so I took a look at its innards to try and get an idea of what's going wrong. I've trimmed off the irrelevant bits and am left with this: Config function in the plugin (should show configuration dialog): void Config(HWND hwndParent) { DialogBox(slave, (const char *) IDD_CONFIG_WINDOW, NULL, configDlgProc); } (Slave is the plugin DLL's HINSTANCE handle.) The proc for the dialog is as follows (I have stripped out all the functionality, since it doesn't appear to have an influence on this problem): BOOL CALLBACK configDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { return 0; } The template for IDD_CONFIG_WINDOW is as follows: IDD_CONFIG_WINDOW DIALOGEX 0, 0, 269, 149 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "64th Note configuration" FONT 8, "MS Sans Serif", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,212,38,50,14 CONTROL "Play Forever",IDC_NOLENGTH,"Button",BS_AUTORADIOBUTTON,7,7,55,8 CONTROL "Always Use Default Length",IDC_SETLEN,"Button",BS_AUTORADIOBUTTON,7,17,101,8 CONTROL "Default Length",IDC_DEFLEN,"Button",BS_AUTORADIOBUTTON,7,29,63,8 EDITTEXT IDC_DEFLENVAL,71,28,38,12,ES_AUTOHSCROLL EDITTEXT IDC_DEFFADEVAL,71,42,38,12,ES_AUTOHSCROLL CONTROL "Detect Silence",IDC_DETSIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,56,63,8 EDITTEXT IDC_DETSILVAL,71,56,38,12,ES_AUTOHSCROLL CONTROL "Slider2",IDC_PRISLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,74,90,108,11 EDITTEXT IDC_TITLEFMT,7,127,255,15,ES_AUTOHSCROLL CONTROL "Default to file name on missing field",IDC_FNONMISSINGTAG, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,114,124,8 CONTROL "Use Recompiler CPU",IDC_RECOMPILER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,7,83,8 CONTROL "Round Frequency",IDC_ROUNDFREQ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,16,73,8 CONTROL "Seek Backwards",IDC_BACKWARDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,26,70,8 CONTROL "Fast Seek",IDC_FASTSEEK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,35,48,8 CONTROL "RSP Sections",IDC_SECTIONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,45,60,8 CONTROL "Soft Amplify",IDC_SOFTAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,54,53,8 CONTROL "Audio HLE",IDC_AUDIOHLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,63,50,8 CONTROL "Auto Audio HLE",IDC_AUTOAUDIOHLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,72,64,8 CONTROL "Display Errors",IDC_DISPERROR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,81,58,8 EDITTEXT IDC_RELVOL,211,104,28,12,ES_AUTOHSCROLL PUSHBUTTON "Cancel",IDCANCEL,212,54,50,14 PUSHBUTTON "Help",IDHELPBUTTON,212,71,50,14 LTEXT "Title format:",IDC_STATIC,7,113,38,8 LTEXT "seconds",IDC_STATIC,112,29,28,8 LTEXT "Default Fade",IDC_STATIC,19,43,42,8 LTEXT "seconds",IDC_STATIC,112,43,28,8 LTEXT "seconds",IDC_STATIC,112,57,28,8 CTEXT "CPU Thread Priority",IDC_STATIC,7,91,63,8 CTEXT "Look ma, I'm data!",IDC_CPUPRI,75,104,108,8 LTEXT "Relative Volume",IDC_STATIC,199,94,52,8 LTEXT "Fade Type",IDC_STATIC,7,75,35,8 COMBOBOX IDC_FADETYPE,45,72,87,74,CBS_DROPDOWNLIST | WS_TABSTOP END Naturally, without any substance in the proc function, the dialog doesn't have any functionality, but it still displays in Winamp when the Config function is invoked. However, it does not appear when I invoke it from my wrapper program. When I monitored the messages sent to the dialog in its proc function, I saw that WM_DESTROY and WM_NCDESTROY were sent within the first few messages, though I have no clue as to why. If I change the Config function so that it displays the plugin's About dialog instead of its configuration dialog, both Winamp and my wrapper will display the About dialog, which suggests that there is something unique to the configuration dialog template that's causing the problem. The modified Config function reads like so: void Config(HWND hwndParent) { DialogBox(slave, (const char *) IDD_ABOUTBOX, NULL, configDlgProc); } The template for the About dialog is as follows: IDD_ABOUTBOX DIALOGEX 0, 0, 152, 151 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About 64th Note" FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN LTEXT "64th Note v1.2 beta 3\nBased on Project 64 1.6 by Zilmar and Jabo\nAudio HLE by Azimer\nPSF concept and tagging by Neill Corlett\nPlayer by hcs, Josh W, dr0\nhttp://hcs64.com/usf",IDC_STATIC,7,94,138,50 CONTROL 110,IDC_STATIC,"Static",SS_BITMAP,26,7,95,86,WS_EX_DLGMODALFRAME END Like I said, my wrapper displays the About dialog just fine, as does Winamp. Why can Winamp display the Config dialog, while my wrapper cannot?

    Read the article

  • Dialog created after first becomes unresponsive unless created first?

    - by Justin Sterling
    After creating the initial dialog box that works perfectly fine, I create another dialog box when the Join Game button is pressed. The dialog box is created and show successfully, however I am unable to type in the edit box or even press or exit the dialog. Does anyone understand how to fix this or why it happens? I made sure the dialog box itself was not the problem by creating and displaying it from the main loop in the application. It worked fine when I created it that way. So why does it error when being created from another dialog? My code is below. This code is for the DLGPROC function that each dialog uses. #define WIN32_LEAN_AND_MEAN #include "Windows.h" #include ".\Controllers\Menu\MenuSystem.h" #include ".\Controllers\Game Controller\GameManager.h" #include ".\Controllers\Network\Network.h" #include "resource.h" #include "main.h" using namespace std; extern GameManager g; extern bool men; NET_Socket server; extern HWND d; HWND joinDlg; char ip[64]; void JoinMenu(){ joinDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_GETADDRESSINFO), NULL, (DLGPROC)GameJoinDialogPrompt); SetFocus(joinDlg); // ShowWindow(joinDlg, SW_SHOW); ShowWindow(d, SW_HIDE); } LRESULT CALLBACK GameJoinDialogPrompt(HWND Dialogwindow, UINT Message, WPARAM wParam, LPARAM lParam){ switch(Message){ case WM_COMMAND:{ switch(LOWORD(wParam)){ case IDCONNECT:{ GetDlgItemText(joinDlg, IDC_IP, ip, 63); if(server.ConnectToServer(ip, 7890, NET_UDP) == NET_INVALID_SOCKET){ LogString("Failed to connect to server! IP: %s", ip); MessageBox(NULL, "Failed to connect!", "Error", MB_OK); ShowWindow(joinDlg, SW_SHOW); break; }   } LogString("Connected!"); break; case IDCANCEL: ShowWindow(d, SW_SHOW); ShowWindow(joinDlg, SW_HIDE); break; } break; } case WM_CLOSE: PostQuitMessage(0); break; } return 0; } LRESULT CALLBACK GameMainDialogPrompt(HWND Dialogwindow, UINT Message, WPARAM wParam, LPARAM lParam){ switch(Message){ case WM_PAINT:{ PAINTSTRUCT ps; RECT rect; HDC hdc = GetDC(Dialogwindow);    hdc = BeginPaint(Dialogwindow, &ps); GetClientRect (Dialogwindow, &rect); FillRect(hdc, &rect, CreateSolidBrush(RGB(0, 0, 0)));    EndPaint(Dialogwindow, &ps);    break;  } case WM_COMMAND:{ switch(LOWORD(wParam)){ case IDC_HOST: if(!NET_Initialize()){ break; } if(server.CreateServer(7890, NET_UDP) != 0){ MessageBox(NULL, "Failed to create server.", "Error!", MB_OK); PostQuitMessage(0); return -1; } ShowWindow(d, SW_HIDE); break; case IDC_JOIN:{ JoinMenu(); } break; case IDC_EXIT: PostQuitMessage(0); break; default: break; } break; } return 0; } } I call the first dialog using the below code void EnterMenu(){ // joinDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_GETADDRESSINFO), g_hWnd, (DLGPROC)GameJoinDialogPrompt);// d = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_SELECTMENU), g_hWnd, (DLGPROC)GameMainDialogPrompt); } The dialog boxes are not DISABLED by default, and they are visible by default. Everything is set to be active on creation and no code deactivates the items on the dialog or the dialog itself.

    Read the article

  • Disable Windows 8 edge gestures/hot corners for multi-touch applications while running in full screen

    - by Bondye
    I have a full screen AS3 game maby with Adobe AIR that runs in Windows 7. In this game it may not be easy to exit (think about kiosk mode, only exit by pressing esc and enter a password). Now I want this game to run in Windows 8. The game is working like expected but the anoying things are these edge gestures/hot corners (left, top, right, bottom) and the shortcuts. I've read articles but none helped me. People talk about registery edits, but I dont get this working + the user needs to restart his/hers computer. I want to open my game, turn off gestures/hot corners and when the game closes the gestures/hot corners need to come back available again. I have seen some applications doing the same what I want to accomplish. I found this so I am able to detect the gestures. But how to ignore they're actions? I also read ASUS Smart Gestures but this is for the touch-pad. And I have tried Classic Shell but I need to disable the edge gestures/hot corners without such programs, just on-the-fly. I also found this but I don't know how to implement this. HRESULT SetTouchDisableProperty(HWND hwnd, BOOL fDisableTouch) { IPropertyStore* pPropStore; HRESULT hrReturnValue = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pPropStore)); if (SUCCEEDED(hrReturnValue)) { PROPVARIANT var; var.vt = VT_BOOL; var.boolVal = fDisableTouch ? VARIANT_TRUE : VARIANT_FALSE; hrReturnValue = pPropStore->SetValue(PKEY_EdgeGesture_DisableTouchWhenFullscreen, var); pPropStore->Release(); } return hrReturnValue; } Does anyone know how I can do this? Or point me into the right direction? I have tried some in C# and C++, but I aint a skilled C#/C++ developer. Also the game is made in AS3 so it will be hard to implement this in C#/C++. I work on the Lenovo aio (All in one) with Windows 8.

    Read the article

  • SetWindowLong in CustomDraw causes unhandled exception

    - by neeul
    Hello, I am making some changes to a CSliderCtrl using the Custom Draw, the control is to be used in a dialog. Here is the structure: In my MessageMap I have : ON_NOTIFY_REFLECT_EX(NM_CUSTOMDRAW, OnNMCustomdraw) The OnNMCustomdraw method looks like the following: BOOL CCustomSliderCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) { *pResult = CDRF_DODEFAULT; LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR); switch(pNMCD->dwDrawStage) { case CDDS_PREPAINT: { //Dialogs don't receive CDRF_NOTIFYITEMDRAW notifcations by returning it as part of pResult, we must //use the following so we ensure we receive the msg SetWindowLong(pNMHDR->hwndFrom, DWL_MSGRESULT, CDRF_NOTIFYITEMDRAW); return TRUE; } case CDDS_ITEMPREPAINT: if(pNMCD->dwItemSpec == TBCD_CHANNEL) { ...SNIP... SetWindowLong(pNMHDR->hwndFrom, DWL_MSGRESULT, CDRF_SKIPDEFAULT); return TRUE; } } return FALSE; } Reading around I learnt that you had to use SetWindowLong to set the return value for the custom draw, otherwise your method will not always receive the CDDS_ITEMPREPAINT message. However, when using SetWindowLong my application will never receive the CDDS_ITEMPREPAINT and so my slider just looks like a standard slider. The application crashes when any sort of interaction takes place upon the slider, such as hovering over it or minimizing and maximizing the dialog. I snipped the TBCD_CHANNEL code as it is never reached. When running in debug mode, it crashes at the end of the AfxUnlockGlobals method, in afxcrit.cpp. Here is a stack trace: Update: Since adding debug symbols, the crash seems to be picked up at CWnd::DefWindowProc mwthod. comctl32.dll!_TrackBarWndProc@16() + 0x551 bytes user32.dll!_InternalCallWinProc@20() + 0x28 bytes user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes user32.dll!_CallWindowProcAorW@24() + 0x51 bytes user32.dll!_CallWindowProcW@20() + 0x1b bytes mfc90ud.dll!CWnd::DefWindowProcW(unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 1043 + 0x20 bytes C++ mfc90ud.dll!CWnd::WindowProc(unsigned int message=15, unsigned int wParam=0, long lParam=0) Line 1756 + 0x1c bytes C++ mfc90ud.dll!AfxCallWndProc(CWnd * pWnd=0x0012fdbc, HWND__ * hWnd=0x000308fe, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 240 + 0x1c bytes C++ mfc90ud.dll!AfxWndProc(HWND__ * hWnd=0x000308fe, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 403 C++ mfc90ud.dll!AfxWndProcBase(HWND__ * hWnd=0x000308fe, unsigned int nMsg=15, unsigned int wParam=0, long lParam=0) Line 441 + 0x15 bytes C++ user32.dll!_InternalCallWinProc@20() + 0x28 bytes user32.dll!_UserCallWinProcCheckWow@32() + 0xb7 bytes user32.dll!_DispatchClientMessage@20() + 0x4d bytes user32.dll!___fnDWORD@4() + 0x24 bytes ntdll.dll!_KiUserCallbackDispatcher@12() + 0x13 bytes user32.dll!_NtUserDispatchMessage@4() + 0xc bytes user32.dll!_DispatchMessageW@4() + 0xf bytes mfc90ud.dll!AfxInternalPumpMessage() Line 183 C++ mfc90ud.dll!CWinThread::PumpMessage() Line 900 C++ mfc90ud.dll!AfxPumpMessage() Line 190 + 0xd bytes C++ mfc90ud.dll!CWnd::RunModalLoop(unsigned long dwFlags=4) Line 4386 + 0x5 bytes C++ mfc90ud.dll!CDialog::DoModal() Line 584 + 0xc bytes C++ SetSelection.exe!CSetSelectionApp::InitInstance() Line 64 + 0xb bytes C++ mfc90ud.dll!AfxWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020a84, int nCmdShow=1) Line 37 + 0xd bytes C++ SetSelection.exe!wWinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * hPrevInstance=0x00000000, wchar_t * lpCmdLine=0x00020a84, int nCmdShow=1) Line 34 C++ SetSelection.exe!__tmainCRTStartup() Line 578 + 0x35 bytes C SetSelection.exe!wWinMainCRTStartup() Line 403 C kernel32.dll!_BaseProcessStart@4() + 0x23 bytes So, does anyone have any insight into this matter? If you need more info just let me know.

    Read the article

  • Cannot create multiple instances of PowerPoint

    - by Excel20
    I'm working on a project where I need to use PowerPoint from C#.net. Initially, I always created one single instance. As of today, I would like to have multiple instance running. I do that like so: Type powerpointType = Type.GetTypeFromProgID("PowerPoint.Application"); object instance1 = Activator.CreateInstance(powerpointType); object instance2 = Activator.CreateInstance(powerpointType); but when I ask for the handle of both instances, by calling hwnd = (int)powerpointType.GetProperty("HWND").GetValue(instance1, null); then I get the same handle twice. My conclusion is that the application is started just once, and the TaskManager comfirms that: Only one process. How come there is only one instance of PowerPoint running, and how can I make it work?

    Read the article

  • SendMessage vs. WndProc

    - by Poma
    I'm trying to extend TextBox control to add watermarking functionality. The example I've found on CodeProject is using imported SendMessage function. [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, uint wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam); void SetWatermark() { SendMessage(this.Handle, 0x1501, 0, "Sample"); } I'm wondering why not use protected WndProc instead void SetWatermark() { var m =new Message() { HWnd = this.Handle, Msg = 0x1501, WParam = (IntPtr)0, LParam = Marshal.StringToHGlobalUni("Sample") }; WndProc(ref m); } Both seem to work fine. Almost all examples I've seen on internet use SendMessagefunction. Why is that? Isn't WndProc function designed to replace SendMessage? P.S. I don't know right to convert string to IntPtr and found that Marshal.StringToHGlobalUni works ok. Is it right function to do this?

    Read the article

  • WebClient error when using a thread in .NET

    - by Kiranu
    I'm having a very weird error using the WebClient class in .NET 4. The app simply downloads some files off the internet and provides output on a textbox (the GUI is WPF). The method that does this is the following: void DownloadFiles(object files) { fileL = (List<string>) files; foreach (string url in fileL) { byte[] data; using (System.Net.WebClient k = new WebClient()) { data = k.DownloadData(url); } //Bunch of irrelevant code goes here... } } (I added the using while trying to divine [yes I'm that desperate/ignorant] a solution, the problem happens even if the webclient is declared and initialized outside the foreach loop) Now the problem appears only when I'm executing this method on a thread separate from the WPF UI main thread. If it is executed on the UI thread then it works perfectly. When a new thread is created with: Thread t = new Thread(DownloadFiles); t.Start(files); The first time the code goes into the loop it will work, but when its the second pass inside the loop, I will always receive a TargetParameterCountException. I can't make any sense of this error. Any help is very much appreciated. EDIT Here are the Exception Details: Exception.Message = "Parameter count mismatch." Exception.InnerException = null Exception.Source = " mscorlib" The StackTrace follows: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at FileDownloader.App.Main() in d:\mis documentos\visual studio 2010\Projects\OneMangaDownloader\FileDownloader\obj\x86\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

    Read the article

  • WebClient error when using a thread in .NET 4

    - by Kiranu
    I'm having a very weird error using the WebClient class in .NET 4. The app simply downloads some files off the internet and provides output on a textbox (the GUI is WPF). The method that does this is the following: void DownloadFiles(object files) { fileL = (List<string>) files; foreach (string url in fileL) { byte[] data; using (System.Net.WebClient k = new WebClient()) { data = k.DownloadData(url); } //Bunch of irrelevant code goes here... } } (I added the using while trying to divine [yes I'm that desperate/ignorant] a solution, the problem happens even if the webclient is declared and initialized outside the foreach loop) Now the problem appears only when I'm executing this method on a thread separate from the WPF UI main thread. If it is executed on the UI thread then it works perfectly. When a new thread is created with: Thread t = new Thread(DownloadFiles); t.Start(files); The first time the code goes into the loop it will work, but when its the second pass inside the loop, I will always receive a TargetParameterCountException. I can't make any sense of this error. Any help is very much appreciated. EDIT Here are the Exception Details: Exception.Message = "Parameter count mismatch." Exception.InnerException = null Exception.Source = " mscorlib" The StackTrace follows: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at FileDownloader.App.Main() in d:\mis documentos\visual studio 2010\Projects\OneMangaDownloader\FileDownloader\obj\x86\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

    Read the article

  • TypeInitializeException on MVVM pattern

    - by Mohit Deshpande
    System.TypeInitializationException was unhandled Message=The type initializer for 'SmartHomeworkOrganizer.ViewModels.MainViewModel' threw an exception. Source=SmartHomeworkOrganizer TypeName=SmartHomeworkOrganizer.ViewModels.MainViewModel StackTrace: at SmartHomeworkOrganizer.ViewModels.MainViewModel..ctor() at SmartHomeworkOrganizer.App.OnStartup(Object sender, StartupEventArgs e) in C:\Users\Mohit\Documents\Visual Studio 2010\Projects\SmartHomeworkOrganizer\SmartHomeworkOrganizer\App.xaml.cs:line 21 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at SmartHomeworkOrganizer.App.Main() in C:\Users\Mohit\Documents\Visual Studio 2010\Projects\SmartHomeworkOrganizer\SmartHomeworkOrganizer\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.ArgumentException Message=Default value type does not match type of property 'Score'. Source=WindowsBase StackTrace: at System.Windows.DependencyProperty.ValidateDefaultValueCommon(Object defaultValue, Type propertyType, String propertyName, ValidateValueCallback validateValueCallback, Boolean checkThreadAffinity) at System.Windows.DependencyProperty.ValidateMetadataDefaultValue(PropertyMetadata defaultMetadata, Type propertyType, String propertyName, ValidateValueCallback validateValueCallback) at System.Windows.DependencyProperty.RegisterCommon(String name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, ValidateValueCallback validateValueCallback) at System.Windows.DependencyProperty.Register(String name, Type propertyType, Type ownerType, PropertyMetadata typeMetadata, ValidateValueCallback validateValueCallback) at System.Windows.DependencyProperty.Register(String name, Type propertyType, Type ownerType, PropertyMetadata typeMetadata) at SmartHomeworkOrganizer.ViewModels.MainViewModel..cctor() in C:\Users\Mohit\Documents\Visual Studio 2010\Projects\SmartHomeworkOrganizer\SmartHomeworkOrganizer\ViewModels\MainViewModel.cs:line 72 InnerException: This bit of code throws a System.ArgumentException before the TypeInitializeException. It says: "Default value type does not match type of property Score": public static readonly DependencyProperty ScoreProperty = DependencyProperty.Register("Score", typeof(float), typeof(MainViewModel), new UIPropertyMetadata(0.0)); Here is the .NET property: public float Score { get { return (float) GetValue(ScoreProperty); } set { SetValue(ScoreProperty, value); } }

    Read the article

  • An unspecified error occurred on the render thread. (NotifyPartitionIsZombie)

    - by red-X
    oke heres the problem, I have a ContentControl3D object from thriple in that im creating a LibraryStack with images it runs fine, until i run the function where the LibraryStack gets created and filled. when i click on any of the objects inside i get the following error An unspecified error occurred on the render thread. with stacktrace at System.Windows.Media.MediaContext.NotifyPartitionIsZombie(Int32 failureCode) at System.Windows.Media.MediaContext.NotifyChannelMessage() at System.Windows.Interop.HwndTarget.HandleMessage(Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at WelkoMap.App.Main() in F:\MediaGarde\Surface\Development\WelkoMap\WelkoMap\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() heres the code that adds and creates the LibraryStack and fills it public void ReplaceBackContent(List<Image> images, List<MediaElement> videos) { ContentControl3D control = this.TryFindParent<ContentControl3D>(); if (control == null) { return; } LibraryStack stack = new LibraryStack(); foreach (Image image in images) { if (image.Parent != null) { continue; } LibraryStackItem item = new LibraryStackItem(); item.Content = image; stack.Items.Add(item); } control.BackContent = stack; } Since it has the NotifyPartitionIsZombie error i already installed windows update KB967634 which had absolutely no effect at all

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >