|
Thanks J,
I was sort of looking for a way to do it without having to change the import. I'm able to do what I need by using "..., String lParam)". But I am wondering if there was some way I could still use the "..., int lParam)" definition and do something special in the calling statment.
|
|
|
|
|
albean wrote:
I was sort of looking for a way to do it without having to change the import.
Well, I don't know of a way, short of using pointers (which I think is more time-consuming). But you can have multiple defs for the same API with the same name. All you have to do is copy the original SendMessage each time and change the lParam parameter's data type.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
I've got two applications, one written in C# and the other is WinBatch (don't ask). In regular C++ it was easy for the WinBatch app to simply PostMessage(..) to the C++ app and using a message map, I could set a function to get executed upon receiving the message.
In C# I'm having difficulty finding a way to receive and map the message received from a non-.Net based app.
Any insight would be greatly appreciated.
|
|
|
|
|
I'm not sure what stage you are at but here is how I handle messages:
<br />
<br />
<br />
protected override void WndProc( ref Message m )<br />
{<br />
const int UWM_HERE_I_AM = 0x1234;<br />
<br />
switch( m.Msg )<br />
{ <br />
case UWM_HERE_I_AM:<br />
m.Result = OnHereIAm( m.WParam, m.LParam );<br />
return;<br />
}<br />
<br />
base.WndProc( ref m );<br />
}<br />
<br />
<br />
|
|
|
|
|
I hadn't even thought of overriding the WndProc... doh!!
Thanks!!!
|
|
|
|
|
I want to place a second Icon on the Title Region of a Form.
How?
|
|
|
|
|
you can override the Onpaint method and do whatever you like. Requires lot of work, after whatever you do call the base.Onpaint with the same arguments;
|
|
|
|
|
My friend's computer is reporting this error when trying to fill a DataSet. All was working fine until he installed the sample PetShop project from Microsoft. Anybody have a CLUE on HOW to fix? HE can't run ANY projects that connect to SQL.
[COLOR=red]Server Error in '/DataListDemo' Application.
--------------------------------------------------------------------------------
'ResourcePool' is not supported on the current platform.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.PlatformNotSupportedException: 'ResourcePool' is not supported on the current platform.
Source Error:
Line 77: SqlDataAdapter da = new SqlDataAdapter("Select * From Titles", conn);
Line 78: DataSet ds = new DataSet();
Line 79: da.Fill(ds, "title_record");
Line 80: DataList1.DataSource = ds;
Line 81: DataList1.DataBind();
[/COLOR]
|
|
|
|
|
See if you have any open connections to the sql server when you do that and check The connectionstring in the SqlConnection object! in the code i usually write
DataList1.DataSource = ds.Tables["title_record"]
but i think is ok either way!
|
|
|
|
|
Hi everyone. (this is my first post to this board, so please forgive me if it doesn't look right).
I am new to c# and i am wondering if someone can help me write a for loop to return all the fields and data in a database. This is the code and it works 100%, but i want it to query the table fields and data dynamically instead of what i have.
<br />
using System;<br />
using Microsoft.Data.Odbc;<br />
using Console = System.Console;<br />
<br />
namespace practice<br />
{<br />
public class dbconnection<br />
{<br />
public void swdata()<br />
{<br />
string msg;<br />
string native;<br />
string src;<br />
string sql;<br />
<br />
try<br />
{<br />
string _db = "DRIVER={MySQL ODBC 3.51 Driver};" +<br />
"SERVER=<server ip>;DATABASE=<db>;" +<br />
"UID=<user>;PASSWORD=<pwd>;" +<br />
"OPTION=512";<br />
OdbcConnection dbconnect = new OdbcConnection(_db);<br />
dbconnect.Open();<br />
<br />
OdbcCommand my_cmd = new OdbcCommand("",dbconnect);<br />
<br />
my_cmd.CommandText = "SELECT * FROM swdata_o";<br />
OdbcDataReader my_dr;<br />
my_dr = my_cmd.ExecuteReader();<br />
<br />
while(my_dr.Read())<br />
{<br />
Console.WriteLine(my_dr.GetInt32(0) + "," + my_dr.GetString(1)<br />
+ "," + my_dr.GetString(2));<br />
}<br />
dbconnect.Close();<br />
}<br />
<br />
catch(OdbcException odbcCon)<br />
{<br />
for(int i=0;i<odbcCon.Errors.Count;i++)<br />
{<br />
msg=odbcCon.Errors[i].Message;<br />
native=odbcCon.Errors[i].NativeError.ToString();<br />
src=odbcCon.Errors[i].Source;<br />
sql=odbcCon.Errors[i].SQLState;<br />
}<br />
}<br />
}<br />
}<br />
<br />
public class open<br />
{<br />
public static void Main(String[] args)<br />
{<br />
dbconnection dbcon = new dbconnection();<br />
dbcon.swdata();<br />
}<br />
}<br />
<br />
}<br />
Thanks for your help.
|
|
|
|
|
I found my answer...
while(my_dr.Read())<br />
{<br />
for(int i=0;i<my_dr.FieldCount;i++)<br />
{<br />
output=output + my_dr.GetValue(i) + ",";<br />
}<br />
}<br />
Console.WriteLine(output + "\r");
|
|
|
|
|
Why do you need to use pointers ?
There is no reason not to use but just wondering....
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
The reason why i asked you that question was that here is for C#. So you shouldn't need to use pointers while you can do what you want to do without using pointers. Anyway. as i said, just wondered
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
yes i guess that you know
I have never coded in Managed C ++ so far, but my first programming experience had begun with C and C ++ ( Borland versions ). But after meeting C# i really stopped using pointers. But that's true that i still use interop. In my opinion, to stop its usage is almost impossible.
I would like to help you about your question but as i said i have no so much knowledge about Managed C ++. I hope someone helps you.
Take care,
cheers,
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
If I have the C code:
beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
can I just use ...(..., short[] Samples, ...)
or do I need pSamples to be an IntPtr?
If you want to check out the simple code (a wav -> mp3 encoder) it's located at http://www.geocities.com/grv575/encode.zip
I don't see what's wrong besides maybe the gc moving the managed arrays around if that's what causing the encode method to fail.
|
|
|
|
|
Hi,
To pass unknown length arrays as parameters is not allowed in C#. You have to inform the length of it to the function and use something like below,
[MarshalAs(UnmanagedType.ByValArray, SizeConst=TheLengthOfArray] ..... your function declaration ( ..., byte [] Samples,.... )
But if the length of the array has not a constant value then you need to find the address of your byte array and then use that address to pass to your function
cheers,
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
can someone please tell me why i cant compile this under windows XP? And since I have windows XP, what can I do to get around this? I'm trying to call BIOS functions to change the VGA. Thanks.
#include <iostream.h>
#include <conio.h>
#include <dos.h>
int main( )
{
union REGS regs;
regs.h.ah = 0x00;
regs.h.al = 0x13; //enter VGA mode 13h
int86(0x10,®s,®s);
getch();
union REGS regs;
regs.h.ah = 0x00;
regs.h.al = 0x02; //back to text mode
int86(0x10,®s,®s);
return 0;
}
|
|
|
|
|
A Question first, is your program in C# or C++?
If it's C#, then the #include 's are the problem(C# doesn't have them)
If it's C++, then you're asking the wrong forum
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|
|
Well I program in both languages... I started in C first and I used to change my video mode by just including the header files stdio.h and dos.h. then calling BIOS functions. I can build this program on windows 95 or windows 98 but I can't build it for some reason on windows XP. So i guess I can scratch iostream and now it's a C source considering im not using cout or cin functions
|
|
|
|
|
OIC
Well, I'm not too familiar with C, and it's not really helping that you're asking it in the C# forums. Try here, they might be better suited to help you.
Nick Seng (the programmer formerly known as Notorious SMC)
God, I pity me! - Phoncible P. Bone
|
|
|
|
|
I'm using Dev-C++ to compile my source. Here is the only error I get tryig to compile:
: aggregate 'union REGS regs' has incomplete type and cannot be initialized
|
|
|
|
|
MATE!!!
I don't think you're reading the responses from people...
This forum is for C# as is "C Sharp"... what you are trying to do looks more like a C++ issue because to do the same thing under .NET would be completely different.
Please be nice and re-post the question under C++
Shaun
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
Windows XP is a pure windows OS not like 98,95,Me so if you want to change the res you have to call Win32 functions see MSDN for details
|
|
|
|
|
It appears that you are trying to use DOS technology in Windows.
You have no direct acces to interrupts anymore since NT 3.0 (1993??) and up.
You have to find the Windows way to change this, because your program runs in protected mode ring 3 and your hardware can only be accessed when your program runs on ring 0, which is the area if the device drivers, like graphics drivers, printer drivers,...
Windows 95, 98, and me did let you access the hardware. But NT like technology does not let you do this, this to increase stability of the system.
Ik hope this helps?
You will have to jump to a modern programing language that can create Windows programs I am afraid.
|
|
|
|
|
Hello,
I want to get the files from a directory, and their order are sorted by their DateTime. I hope to list all file in the listview after sorting.
The following code I used to get files in directory.
<br />
DirectoryInfo di = new DirectoryInfo(path + "\\");<br />
FileInfo[] theFiles = di.GetFiles(); <br />
<br />
foreach(FileInfo theFile in theFiles)
{<br />
ArrayList FileArrayList = new ArrayList();<br />
FileArrayList.Add(theFile.FullName);
}
what should I do right now? I don't know how to sort the collection of Files in dateTime order..
Or, I need to list all files in ListView first, and the sort it in ListView?
Please help me with example...
Thanks a lot
|
|
|
|