|
I want to record sound from mp3 player ,media player,ie
|
|
|
|
|
|
is it possible to sycn two sql database data with Microsoft Sync Framework. if so can anyone give sample code.
thanks.tbhattacharjee
|
|
|
|
|
Hi !
I'm working shell context menu on 64 pc.
I rebuild app under x64 pc.
I want add menu item to windows context menu.Registery is OK and windows explorer find my dll.
But InsertMenuItem WinAPI function not working!
MENUITEMINFO mii = new MENUITEMINFO();
mii.cbSize =(uint)Marshal.SizeOf(typeof(MENUITEMINFO));
mii.fMask = (uint)MIIM.TYPE | (uint)MIIM.STATE |(uint)MIIM.SUBMENU;
mii.fType =(uint) MF.STRING;
mii.wID = idCmdFirst + num;
mii.dwTypeData = "My menu text";
mii.fState =(uint)MF.ENABLED;
mii.cch = (uint)mii.dwTypeData.Length;
InsertMenuItem(hmenu, iMenu+1, true, ref mii);
My defenition :
[DllImport("user32.dll")]
public static extern bool InsertMenuItem(uint hMenu, uint uItem, bool fByPosition,[In] ref MENUITEMINFO lpmii);
[StructLayout(LayoutKind.Sequential)]
public struct MENUITEMINFO
{
public uint cbSize;
public uint fMask;
public uint fType;
public uint fState;
public int wID;
public int hSubMenu;
public int hbmpChecked;
public int hbmpUnchecked;
public int dwItemData;
public String dwTypeData;
public uint cch;
public int hbmpItem;
}
Please help me. (I know writing shell menu under .net is not good,but i very want see it).
Thanks.We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
In Win64 all pointers take 64 bits, hence uint hMenu is wrong in public static extern bool InsertMenuItem(uint hMenu, uint uItem, bool fByPosition,[In] ref MENUITEMINFO lpmii); .
One should always use IntPtr when passing a handle or pointer; and yes, www.pinvoke.net has some errors in that regard.
Another potential problem may be the string in your structure; not sure that gets marshaled automatically.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi Luc.
Thanks for your reply.
I change my code like that :
[DllImport("user32.dll")]
public static extern bool InsertMenuItem(IntPtr hMenu, uint uItem, bool fByPosition,[In] ref MENUITEMINFO lpmii);
[DllImport("user32.dll")]
public static extern int SetMenuItemBitmaps(IntPtr hmenu, uint uposition, uint uFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked);
InsertMenuItem not yet working , but SetMenuItemBitmaps working well.
Please help me .
Thanks .We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
1. You have used the flag MIIM.SUBMENU (fMask) but you hasn't set the hSubMenu value.
2. You also should adjust your struct to use IntPtr instead of int.
Like this:
[StructLayout(LayoutKind.Sequential)]
public struct MENUITEMINFO
{
public uint cbSize;
public uint fMask;
public uint fType;
public uint fState;
public int wID;
public IntPtr hSubMenu;
public IntPtr hbmpChecked;
public IntPtr hbmpUnchecked;
public IntPtr dwItemData;
public String dwTypeData;
public uint cch;
public IntPtr hbmpItem;
}
There may be also the problem with the (LPTSTR)String dwTypeData. If it doesn't work you could try StringBuilder instead.Greetings
Covean
|
|
|
|
|
Thanks Covean.
You are right .Problem is fixed.
Now i have shell menu working both 32 bit and 64 bit Windows version!
Thank you very much! We are haven't bug,just temporarily undecided problems.
|
|
|
|
|
You're welcome! Greetings
Covean
|
|
|
|
|
Thanks, I had exactly the same problem !
Here my new code, if it can help someone esle
[StructLayout(LayoutKind.Sequential)]
public struct MENUITEMINFO
{
public uint cbSize;
public uint fMask;
public uint fType;
public uint fState;
public uint wID;
public IntPtr hSubMenu;
public IntPtr hbmpChecked;
public IntPtr hbmpUnchecked;
public IntPtr dwItemData;
public string dwTypeData;
public uint cch;
public IntPtr hbmpItem;
}
public class DllImports
{
[DllImport("user32.dll")]
public static extern bool InsertMenuItem(IntPtr hMenu, uint uPosition, uint uFlags, [In] ref MENUITEMINFO mii);
[DllImport("user32")]
public static extern UInt32 SetMenuItemBitmaps(IntPtr hMenu, uint uPosition, uint uFlags, IntPtr hBitmapUnchecked, IntPtr hBitmapChecked);
}
private void AddMenuItem(IntPtr hMenu, uint id, uint position, string text, Bitmap icon, IntPtr? hSubMenu)
{
MENUITEMINFO mii = new MENUITEMINFO();
mii.cbSize = (uint)Marshal.SizeOf(typeof(MENUITEMINFO));
mii.fMask = (uint)MIIM.ID | (uint)MIIM.STRING | (uint)MIIM.SUBMENU;
mii.wID = id;
mii.dwTypeData = text;
if (hSubMenu.HasValue)
{
mii.hSubMenu = hSubMenu.Value;
}
DllImports.InsertMenuItem(hMenu, position, (uint)MF.BYPOSITION, ref mii);
if (icon != null)
{
DllImports.SetMenuItemBitmaps(hMenu, id, (uint)MF.BYCOMMAND, icon.GetHbitmap(), icon.GetHbitmap());
}
}
The biggest problem was this line :
mii.cbSize = (uint)Marshal.SizeOf(typeof(MENUITEMINFO));
As in all exemples you found on web, the size is set to 48 by default and not calculate.
Thanks again.
Decco
|
|
|
|
|
Dear Frnds,
I have got reg nos and marks. Now im supposed to allot rank.
What i tried : LIST<T>, SORTEDLIST, HASHTABLE, AND ARRAYLIST.
from the above, sortedlist works but it sorts the key ie. reg nos and not the marks.
help required.
|
|
|
|
|
Hi,
did you try .Sort() after writing and before reading the collection?
Pls send code if it doesn't help
bye
|
|
|
|
|
monstale wrote: did you try .Sort() after writing and before reading the collection?
.Sort will sort on key not on value, he need to change design of it application or do manually sorting! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
sachees123 wrote: from the above, sortedlist works but it sorts the key ie. reg nos and not the marks.
it is because your key is registration no not marks. Also you can't have marks as key as there chance you are getting same marks twice or thrice or so on! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
A List<T> where T implements IComparable<T> is the best one because it has flexibility in that
you can provide custom IComparer(s) when calling the .Sort() method.
Sure a Dictionary<key,value> is faster but just like the SortedList you can only sort/search based on the key.
|
|
|
|
|
Hi All,
I am using a query i.e."select max(empcode) as code from demotable"
it was giving a value in sqlserver,but i want to implement it in c#.net by using the code. can any one help me plz...
Regards,
Basha.
|
|
|
|
|
add System.Data.SqlClient namespace
1. Open SQL connection
2. Call SqlCommand member for your query!
3. Read your value by DataReader "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
How can i auto star my programs when windows start up?!
i know 2 ways that maybe not work well sometimes!
i can make a shortcut of my program in start up folder
i can make a registry value in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
but sometimes viruses dont allow this methods work well
anybody know how can i make a start up program with any other ways???
|
|
|
|
|
you can develop a windows service that autostart your program when windows start.
|
|
|
|
|
Masterhame wrote: but sometimes viruses dont allow this methods work well
then make sure you don't have viruses; don't change your code for this reason!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Masterhame wrote: anybody know how can i make a start up program with any other ways???
these are generally expected two ways to starting desktop based application. If your tech lead allows you to change framework, you can also utilize services of WINDOW Service as told by Mr. Dudeja! "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
The easiest way is to make it a Windows Scheduled Task.
|
|
|
|
|
HI.. This is my backup query.. its not workin
Pls send me wat's the error in this query and how to get backup database..
alter PROCEDURE [dbo].[sp_BackupDatabase]
@databasename varchar(32),
@path varchar(256),
@filename varchar(64)AS
set nocount on
declare @sql varchar(4000)
select @sql ='BACKUP DATABASE ' + ltrim(rtrim( @databasename ))
select @sql = @sql +'TO DISK = ''' + ltrim(rtrim(@path)) + ltrim(rtrim(@filename)) + ''' '
select @sql = @sql +'WITH INIT'
print @sql
execute ( @sql )
select 'Database successfully backed up!' [Result]
|
|
|
|
|
Hi. I am getting data from a MySql Datasource like this:
string hostname = "localhost";
string username = "root";
string password = "0000";
string mySelectQuery = "SELECT * FROM report;";
MySqlConnection myConnection = new MySqlConnection("server=" + hostname + ";uid=" + username + ";pwd=" + password + ";database=elearning;Charset=latin1;");
MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
chart1.DataSource = myCommand;
chart1.Series["Series 1"].XValueMember = "ExamNumber";
chart1.Series["Series 1"].YValueMembers = "Percentage";
chart1.DataBind();
I am using the chart control. I got yesterday so probably i should return it before the warranty expires . There is no error but the chart just won't show when i run the application. What could be wrong.Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|