I have an access violation error in my WinForms app (WindowsApp1.exe) which says:
Exception thrown at 0x723F8B1E (comctl32.dll) in WindowsApp1.exe: 0xC0000005: Access violation writing location 0x00000002
which means it's trying to access location 0x00000002 (2) When an task dialog or a dialog, or anything, is done on the computer, the function which does so allocates an memory address, then writes to it the information needed to complete, which this action
can raise an error if the address allocated is not within your allocated address space (i.e. an address allocated by the system) such as 0x00000002, That happens when I implement TaskDialogIndirect() as follows:
Declare Function TaskDialogIndirect Lib "comctl32" (TASKDIALOGCONFIG, Integer, Boolean, Boolean) As Long
TaskDialogIndirect(tdc, 2, Nothing, Nothing);
(I wrote the types only because I don't remember the names of the parameters) It causes an error because comctl32.dll is trying to write to 0x00000002 (WinForms apps always load comctl32.dll v6) So the problem is in the , function, the function call, or the
parameters to the function.
How do I solve this?