|
No, it means that you need to put up a help topic on your web site that helps users configure their applications properly. Your server can't configure the client for them, as that would be a serious security vulnerability.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
PS: If you're the guy that asked something similar before, then I'm sorry but I didn't understand your first question because of the extra code you included regarding the Crystal Reports document.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi
Is it possible to create a new instance of an object at runtime??
-If possible how?? (a form is a good starting point)
Thx,
Besinci
|
|
|
|
|
|
Thx a lot,
This is what I was looking for
|
|
|
|
|
hi guys, could anyone please help me in my program, the thing is that i want to write a function that calculates the check digit in EAN-13 barcode symbology.
thnx
|
|
|
|
|
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#
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
SendMessageFirstDayOfWeek(dtpStartDate.Handle, MCM_SETFIRSTDAYOFWEEK, 0, 0);
Any help would be greatly appeciated!
|
|
|
|
|
In you're code you're not using the MonthCalendar control's Handle like you are in your VB6 code. You must get the handle to the calendar first:
using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
class DTPSample : Form
{
DateTimePickerEx dtp;
[STAThread]
static void Main()
{
Application.Run(new DTPSample());
}
DTPSample()
{
dtp = new DateTimePickerEx();
Controls.Add(dtp);
dtp.FirstDayOfWeek = DayOfWeek.Monday;
dtp.Location = new Point(8, 8);
Text = "DTP Sample";
}
}
public class DateTimePickerEx : DateTimePicker
{
const int DTM_GETMONTHCAL = 0x1008;
const int MCM_SETFIRSTDAYOFWEEK = 0x100f;
DayOfWeek firstDayOfWeek;
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam,
IntPtr lParam);
public DateTimePickerEx()
{
}
public IntPtr MonthCalendar
{
get
{
if (IsHandleCreated)
{
return SendMessage(Handle, DTM_GETMONTHCAL,
IntPtr.Zero, IntPtr.Zero);
}
return IntPtr.Zero;
}
}
[DefaultValue(DayOfWeek.Sunday)]
public DayOfWeek FirstDayOfWeek
{
get { return firstDayOfWeek; }
set
{
bool fireEvent = firstDayOfWeek != value;
firstDayOfWeek = value;
if (fireEvent)
OnFirstDayOfWeekChanged(EventArgs.Empty);
}
}
public event EventHandler FirstDayOfWeekChanged;
protected virtual void OnFirstDayOfWeekChanged(EventArgs e)
{
if (FirstDayOfWeekChanged != null)
FirstDayOfWeekChanged(this, e);
}
protected override void OnDropDown(EventArgs e)
{
base.OnDropDown(e);
if (MonthCalendar != IntPtr.Zero)
{
SendMessage(MonthCalendar, MCM_SETFIRSTDAYOFWEEK, IntPtr.Zero,
new IntPtr(firstDayOfWeek == DayOfWeek.Sunday ? 6 :
(int)firstDayOfWeek - 1));
}
}
} Also notice how I declare SendMessage using CharSet=CharSet.Auto in the DllImportAttribute . This will append "A" and "W" for the appropriate functions when necessary. This helps to produce robust assemblies. Declaring the parameters as the correct type - in this case, both wParam and lParam are actually IntPtr s - also helps. An IntPtr is the width of a pointer on the underlying platform.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Your example worked great! I see now that I was trying to use the handle to the DateTimePicker instead of the MonthCalendar component. I still don't completely understand the code, but it will give me something to study. Thank you for the help!
|
|
|
|
|
hi all.
i have created two forms. one form(Main form) has a text box. i am creating an object of the second form(Input form) and displaying it. now i take input from the user in this input form. then i close this form.
Now i want the input data to be displayed in the first form(main form). how can i do this??
thanking in anticipation
mahesh
|
|
|
|
|
Expose a property in the second form that gets the text input provided by the user and returns it. You can then access that property from the main form.
Regards
Senthil
My Blog
|
|
|
|
|
what is meant by exposing property exactly?
is it same as get set?
dfgdfgdfgdfg
|
|
|
|
|
You could use get set, or you could just write a small function that returns the value. Exposing it is just a fancy way of saying 'make it public'.
|
|
|
|
|
I am making a propertygrid that function like a "treeview" or "menubar". I want my propertygrid attribute to expand like a tree when the field of the attribute!="", and i want it to expand a sibling and a child like menu bar. I want all the expanded attribute to be editable too.
Is it posible to do that? How can i do that?
I have done half way... expand the attribute by returning a class to the propertygrid and the class contain attribute that is a expandableObject
When i expand the attribute the field of the attribute became uneditable. How can i make it editable?
Please help...
|
|
|
|
|
Hi,
I want to access the methods in a C# dll. How can I use it in Visual C++ 6.0?
It's a simple dll. I don't want COM stuff get invoke. Because I am not familar with COM and I don't want to be bothered with registry stuff. Any idea?
Thanks in Advance.
|
|
|
|
|
|
If you we're going the other way (using a VC++ .DLL in C#), it would be simple. But using a C#, or any other managed language, you have to go through COM to bridge between the two execution enviornments.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What would be the fastest way to count the number of set bits in a byte?
I currently use a static array which has the number of bits set for each possible combination of set bits then use the byte value to index into that array.
Are there faster ways to do it?
|
|
|
|
|
|
Is it? Drat! It's where my code spends most of its time - although it is doing it billions of times so I don't suppose I can complain.
Thanks for the reply.
|
|
|
|
|
I have a general rule when it comes to optimization:
- the fastest way to do something is not to do it
i.e. does you code really need to count the bits? is there a way to avoid it?
what are you counting bits for btw?
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
It's a database application which stores the presence or non presence of variable values in bit vectors stored in byte arrays. Counts and analyses can then be run very quickly - for example:
All people who live in England, drive a ford, eat out at restaurants once a week, read the Times and don't have a pet - on a database of 100 million individuals takes half a second.
Counting the bits gives the total number matching the criteria after the logic processing has done its thang.
TBH, it's not too much of a worry that the bit counting is taking a lot of the time as I am happy with half a second on 100 million individuals - and I doubt I will ever put 100 million individuals into a real database, I was just stress testing then seeing where it was spending its time.
|
|
|
|
|
lol strange coincidence...
i used to design direct marketing systems for exactly this kind of thing (CMT/NDL/Claritas)
check you IO and Page faulting...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Really? I used to write the software at Dudley Jenkins for their direct marketing "lifestyle" database. I have set up on my own now.
I have got the IO and Page Faulting sorted, I believe. There is certainly very little page faulting when analysing the 100 million and the IO seems to have very little impact. It's been quite a ride getting this thing to work this fast in C# after writing similar software in C++.
|
|
|
|
|
Speed is always difficult do maintain with so many different layers inserted between processor and application.
C# feels good, though. Most of the times
Cheers
Sid
|
|
|
|