Click here to Skip to main content
15,889,867 members
Home / Discussions / C#
   

C#

 
GeneralRe: Avoiding open/save diaolg box Pin
see0725-Feb-05 5:11
see0725-Feb-05 5:11 
GeneralRe: Avoiding open/save diaolg box Pin
Heath Stewart25-Feb-05 5:14
protectorHeath Stewart25-Feb-05 5:14 
GeneralRe: Avoiding open/save diaolg box Pin
Heath Stewart23-Feb-05 12:48
protectorHeath Stewart23-Feb-05 12:48 
QuestionCreating new objects at runtime?? Pin
Besinci23-Feb-05 7:12
Besinci23-Feb-05 7:12 
AnswerRe: Creating new objects at runtime?? Pin
Nick Parker23-Feb-05 7:45
protectorNick Parker23-Feb-05 7:45 
GeneralRe: Creating new objects at runtime?? Pin
Besinci23-Feb-05 7:56
Besinci23-Feb-05 7:56 
Generalbarcode check digit Pin
sardonicus23-Feb-05 7:07
sardonicus23-Feb-05 7:07 
GeneralProblems porting an API call from VB6 to C# Pin
smithriver23-Feb-05 7:00
smithriver23-Feb-05 7:00 
In VB6 I was able to use MCM_SETFIRSTDAYOFWEEK to set Monday as the first day of the week in the DateTimePicker calendar (in the dtp.DropDown event). My attempts to port the same API call to the C# version have been unsuccessful; it compiles and runs, but it doesn't change the first day of the week in the calendar. I've included both the VB6 and C# code below. (Note: the declarations and DropDown code are in the same form).

'VB6
'**************************************************************************
'Needed for DateTimePicker calendar "first day of week"
Const DTM_FIRST = &H1000
Const DTM_GETMONTHCAL = DTM_FIRST + 8
Const MCM_FIRST = &H1000
Const MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
        (ByVal hWnd As Long, ByVal wMsg As Long, _
         ByVal wParam As Long, ByVal lParam As Any) As Long
'**************************************************************************


In the VB6 DTPicker DropDown event
'Get a reference to the handle of the DateTimePicker control
lCalHwnd = SendMessage(ctlDateTimePicker.hWnd, DTM_GETMONTHCAL, 0&, ByVal 0&)
    
'Send an API message to change the presentation
'     lCalHwnd = handle to the control
'     MCM_SETFIRSTDAYOFWEEK = Flag for message to send
'     0& = Unused parameter
'     0& = Day of week (0 = Monday … 6 = Sunday)
SendMessage lCalHwnd, MCM_SETFIRSTDAYOFWEEK, 0&, ByVal 0&


// C#
//*************************************************************************
// Needed for DTPicker calendar "first day of week"
private const int DTM_FIRST = 0x1000;
private const int DTM_GETMONTHCAL = DTM_FIRST + 8;
private const int MCM_FIRST = 0x1000;
private const int MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15;

[DllImport("user32.dll",EntryPoint="SendMessageA")]
extern static IntPtr SendMessageFirstDayOfWeek(IntPtr hWnd, int wMsg, int wParam, int lParam);
//*************************************************************************


In the C# DateTimePicker DropDown event
// Send an API message to change the presentation
//     dtpStartDate.Handle = handle to the control
//     MCM_SETFIRSTDAYOFWEEK = Flag for message to send
//     0 = Unused parameter
//     0 = Day of week (0 = Monday … 6 = Sunday)
SendMessageFirstDayOfWeek(dtpStartDate.Handle, MCM_SETFIRSTDAYOFWEEK, 0, 0);


Any help would be greatly appeciated!
GeneralRe: Problems porting an API call from VB6 to C# Pin
Heath Stewart23-Feb-05 12:37
protectorHeath Stewart23-Feb-05 12:37 
GeneralRe: Problems porting an API call from VB6 to C# Pin
smithriver24-Feb-05 8:15
smithriver24-Feb-05 8:15 
Generalprinting in textbox of a form from other form Pin
maheshfour23-Feb-05 5:56
maheshfour23-Feb-05 5:56 
GeneralRe: printing in textbox of a form from other form Pin
S. Senthil Kumar23-Feb-05 6:57
S. Senthil Kumar23-Feb-05 6:57 
GeneralRe: printing in textbox of a form from other form Pin
maheshfour23-Feb-05 7:56
maheshfour23-Feb-05 7:56 
GeneralRe: printing in textbox of a form from other form Pin
Anonymous23-Feb-05 8:53
Anonymous23-Feb-05 8:53 
QuestionHow to make expanded attribute in property grid field editable Pin
lee meng23-Feb-05 5:48
lee meng23-Feb-05 5:48 
QuestionWhat is the simple way to use a C# dll in VC++ Pin
yyf23-Feb-05 5:18
yyf23-Feb-05 5:18 
AnswerRe: What is the simple way to use a C# dll in VC++ Pin
Judah Gabriel Himango23-Feb-05 9:49
sponsorJudah Gabriel Himango23-Feb-05 9:49 
AnswerRe: What is the simple way to use a C# dll in VC++ Pin
Dave Kreskowiak24-Feb-05 3:24
mveDave Kreskowiak24-Feb-05 3:24 
GeneralCounting set bits Pin
PaleyX23-Feb-05 5:12
PaleyX23-Feb-05 5:12 
GeneralRe: Counting set bits Pin
Philip Fitzsimons23-Feb-05 6:33
Philip Fitzsimons23-Feb-05 6:33 
GeneralRe: Counting set bits Pin
PaleyX23-Feb-05 6:51
PaleyX23-Feb-05 6:51 
GeneralRe: Counting set bits Pin
Philip Fitzsimons23-Feb-05 6:59
Philip Fitzsimons23-Feb-05 6:59 
GeneralRe: Counting set bits Pin
PaleyX23-Feb-05 7:10
PaleyX23-Feb-05 7:10 
GeneralRe: Counting set bits Pin
Philip Fitzsimons23-Feb-05 7:15
Philip Fitzsimons23-Feb-05 7:15 
GeneralRe: Counting set bits Pin
PaleyX23-Feb-05 7:26
PaleyX23-Feb-05 7:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.