|
It looks like a byte-ordering problem. Your bytes 74 15 00 00 probably represent 0x00001574 (5492 decimal).
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
omg
Your are right. I forgot to convert from big to little endian!!!
Thank you!!!
|
|
|
|
|
any body ...
how i can make botton that clear the last letter in the rishbox or in any text box .
please send the code......
thanks very much
|
|
|
|
|
Refer the following code.
private void button1_Click(object sender, System.EventArgs e)
{
this.richTextBox1.Focus();
SendKeys.Send("{BACKSPACE}");
}
|
|
|
|
|
Sorry...I just forgot to add the namespace. It is System.Windows.Forms . Same as RichTextBox or TextBox . Be sure of adding
using System.Windows.Forms;
|
|
|
|
|
Another solution:
private void button1_Click(object sender, EventArgs e)
{
this.richTextBox1.Text = this.richTextBox1.Text.Remove(this.richTextBox1.TextLength - 1, 1);
}
www.troschuetz.de
|
|
|
|
|
It will cause Undo Buffer Reset as there is a bug in RichTextBox.Text .
Please note that the Undo property does not work correctly if text is retrieved from the richTextBox using richTextBox.Text property
refer mocrosoft site for the bug detail
http://support.microsoft.com/default.aspx?kbid=812943
|
|
|
|
|
THX for the info.
I tried the code snippet on a WinNT computer that is obviously not affected by the bug.
www.troschuetz.de
|
|
|
|
|
Yeah, u r right. This occurs under XP.
If you override the Text property and get and set the Text using API calls (i.e.WM_GETTEXT ). The bug gets fixed.
|
|
|
|
|
Yeah, u r right. This occurs under XP.
If you override the Text property and get and set the Text using API calls (i.e.WM_GETTEXT ). This bug gets fixed.
|
|
|
|
|
//c# code:
public class Win32 {......
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
public struct SP_DEVICE_INTERFACE_DETAIL_DATA
{
public uint cbSize;
public char* DevicePath;
}
[DllImport("setupapi.dll", CharSet=CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetupDiGetDeviceInterfaceDetail(
[In]IntPtr DeviceInfoSet,
[In] SP_DEVICE_INTERFACE_DATA *DeviceInterfaceData,
[Out]SP_DEVICE_INTERFACE_DETAIL_DATA *DeviceInterfaceDetailData,
[In]int DeviceInterfaceDetailDataSize,
[Out]int *RequiredSize,
[Out]SP_DEVINFO_DATA *DeviceInfoData
);
......
}
public class usbdevice {......
ptrDeviceInterfaceDetailData = (Win32.SP_DEVICE_INTERFACE_DETAIL_DATA*)Win32.GlobalAlloc(Win32.GPTR,nBytesRequired);
ptrDeviceInterfaceDetailData->cbSize = (uint)sizeof(Win32.SP_DEVICE_INTERFACE_DETAIL_DATA);
ptrDeviceInfoData->cbSize = Marshal.SizeOf( new Win32.SP_DEVINFO_DATA().GetType() );
bResult =Win32.SetupDiGetDeviceInterfaceDetail(hDevInfo,
ptrDeviceInterfaceData,
ptrDeviceInterfaceDetailData, //[out] pointer to a buffer to store the interface detail data
nBytesRequired, // the buffer size
null,
ptrDeviceInfoData);
lasterror = Win32.GetLastError();// Error number:1784. How to settle this problem????
|
|
|
|
|
According to winerror.h this error is ERROR_INVALID_USER_BUFFER: The supplied user buffer is not valid for the requested operation.
Hint, fix the way you allocate it.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi!Alex ,
Thank you very much!
Yes,I know what the error is.But I just do not how
to modify my code to settle this problem.I suppose this error is come from the definition of structure SP_DEVICE_INTERFACE_DETAIL_DATA or memory allocation for it.Can you check my code and tell me what the problem is?
|
|
|
|
|
I'm a delphi programmer. I have the same problem when programming, but I find a way to correct it. Take a look at following code which in bold. I hope it can help you.
const
GUID_CLASS_COMPORT: TGUID = (
D1:$86e0d1e0; D2:$8089; D3:$11d0; D4:($9c, $e4, $08, $00, $3e, $30, $1f, $73));
procedure EnumPortsWdm(AList: TStrings);
var
LGuid: TGUID;
LDeviceInfo: HDEVINFO;
LDevice: TSPDevInfoData;
LDeviceInterfaceData: TSPDeviceInterfaceData;
LDeviceInterfaceDetailData: PSPDeviceInterfaceDetailData;
LSuccess, LIsUsbDevice: Boolean;
LDeviceInterfaceDetailDataSize,
LRequiredSize: DWORD;
LIndex: DWORD;
LFriendlyName: array[0..255] of Char;
LDesc: array[0..255] of Char;
LLocInfo: array[0..255] of Char;
LComPortInfo: TComPortInfo;
begin
ClearPortsList(AList);
LGuid := GUID_CLASS_COMPORT;
LDeviceInfo := SetupDiGetClassDevs(@GUID_CLASS_COMPORT,
nil, 0, DIGCF_PRESENT or DIGCF_DEVICEINTERFACE);
if (Cardinal(LDeviceInfo) = INVALID_HANDLE_VALUE) then
begin
Exit;
end;
SetupDiGetDeviceInterfaceDetail(LDeviceInfo,
@LDeviceInterfaceData, nil, 0, @LRequiredSize, @LDevice);
LDeviceInterfaceDetailDataSize := LRequiredSize;
GetMem(LDeviceInterfaceDetailData, LRequiredSize);
try
LDeviceInterfaceData.cbSize := sizeof(TSPDeviceInterfaceData);
LDeviceInterfaceDetailData.cbSize := sizeof(TSPDeviceInterfaceDetailData);
LIndex := 0;
while True do
begin
if not SetupDiEnumDeviceInterfaces(LDeviceInfo,
nil, LGuid, LIndex, LDeviceInterfaceData) then
begin
Break;
end;
LDevice.cbSize := sizeof(TSPDevInfoData);
LDevice.ClassGuid := GUID_CLASS_COMPORT;
if not SetupDiGetDeviceInterfaceDetail(LDeviceInfo,
@LDeviceInterfaceData,
LDeviceInterfaceDetailData,
LDeviceInterfaceDetailDataSize,
@LRequiredSize, @LDevice) then
begin
Break;
end;
LSuccess := SetupDiGetDeviceRegistryProperty(LDeviceInfo,
LDevice, SPDRP_FRIENDLYNAME, nil,
PByte(@LFriendlyName[0]), sizeof(LFriendlyName), nil);
LSuccess := LSuccess and SetupDiGetDeviceRegistryProperty(
LDeviceInfo, LDevice, SPDRP_DEVICEDESC, nil,
PByte(@LDesc[0]), sizeof(LDesc), nil);
LIsUsbDevice := FALSE;
if SetupDiGetDeviceRegistryProperty(
LDeviceInfo, LDevice, SPDRP_LOCATION_INFORMATION, nil,
PByte(@LLocInfo[0]), sizeof(LLocInfo), nil) then
begin
LIsUsbDevice := (Pos('USB', LLocInfo) = 1);
end;
if LSuccess then
begin
LComPortInfo := TComPortInfo.Create;
LComPortInfo.DevPath := PChar(@LDeviceInterfaceDetailData.DevicePath[0]);
LComPortInfo.FriendlyName := LFriendlyName;
LComPortInfo.PortDesc := LDesc;
LComPortInfo.IsUsbDevice := LIsUsbDevice;
AList.AddObject(LFriendlyName, LComPortInfo);
end;
LIndex := LIndex + 1;
end;
finally
FreeMem(LDeviceInterfaceDetailData);
SetupDiDestroyDeviceInfoList(LDeviceInfo);
end;
end;
|
|
|
|
|
Hi All,
I want to design a menu for my applicaiton having looks 100% like windows XP start menu. Can any one give me idea , hoe to do that ? or if already someone has done this then can he/she provide me link?
Thanx in Advance.
sorry for my bad English.
|
|
|
|
|
|
Hi friends
I make a session in asp.net using C# and check the session through glob.aspx.cs
if(session["username"]=="")
{
Resplose.Redirect("Login.aspx");
}
but now i my session is creat on login page if page before login i have to my glob.aspx.cs file check for the session then it generate error that session is not declare Is there any solution to check whether the session is created or not and how to avoid some pages to check the session. suppose i have one page that comes before login name is info.aspx i want that for this page glob.aspx.cs must not be check session is there any way to avoid this page
Thanking You
Hemant Mane
|
|
|
|
|
|
|
How do I add Ctrl+Z character in the end of a string ?
Anyone can help and give the example in C# ?
Thx in advance
|
|
|
|
|
|
lol
Thx Colin... just wanna make sure that Ctrl+Z is 26.
"Courage choose who will follow, Fate choose who will lead" - Lord Gunner, Septerra Core
"Press any key to continue, where's the ANY key ?" - Homer Simpsons
Drinking gives me amazing powers of insight. I can solve all the worlds problems when drunk, but can never remember the solutions in the morning. - Michael P Butler to Paul Watson on 12/08/03
|
|
|
|
|
How to convert data type of chat* to data type of IntPtr(or string)?
Thanks!
|
|
|
|
|
|
Hi!leppie,
Do you have any usb device on hand,such as u-disk,mp3 or cardreader? If you do,then I will send my project to you and you can debug it to see what problem it is.
Thanks!
|
|
|
|