|
Actually, I did read your message and the question was this:
My question is... can this nasty function be used to set a NORMAL WINDOW?
The answer to that question is No. But, like you said, the window must be modified before you can call this function.
Also, you said:
You don't have to care about the parameters.
Actually, when people start posting questions about why API calls don't work, it's because the parameters are screwed up. We'd need to see you declaration for UpdateLayeredWindow , your structure definitions that are used by it, the code the fills in these structures, and the code that sets up the call to UpdateLayeredWindow. Without that, you're hiding the small details that can make all the difference in the world.
From what I've seen in other source code, this isn't very complex.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Haha. You're ok : ). You are kind of right. Let me just ask this question: do I need to use a bitmap to use that function (I guess no... but I'm asking just to be sure). And another question: did you come across that function and used it until now?
Hey, for all the trouble I gave you, I'll make it up by making an article about using this function (when and if I'm gonna make it work) in both C# and VB.Net, so I can wash my cardinal sin of cross posting : D, haha. Happy ? : ). Have a nice day mate! : ).
The Greater Mind Balance
|
|
|
|
|
In a form i have a button(btnCaption) and a panel(pnlTemplate).Button's Location can be changed with mouse and ctrl key.If i press at button's left top corner then change its location, there is no problem, but When i press any other side of button; while i drop button, mouse pointer(X,Y)location is set to button left top corner. Probably i have to change pnlTemplate_DragDrop sub, but i couldnt yet. please help me.
-CODE-----------------------------------------------------------
Dim m_MouseIsDown As Boolean = False
Dim LastClickedButton As String
Private Sub btnCaption_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnCaption.MouseDown
If e.Button = MouseButtons.Left And m_ControlKeyPressed Then
m_MouseIsDown = True
End If
End Sub
Private Sub btnCaption_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnCaption.MouseMove
If m_MouseIsDown Then
btnCaption.DoDragDrop(btnCaption, DragDropEffects.Move)
End If
End Sub
Dim m_ControlKeyPressed As Boolean = False
Private Sub btnCaption_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles btnCaption.KeyUp
Select Case e.KeyCode
Case Keys.Escape : m_MouseIsDown = False : m_ControlKeyPressed = False
Case Keys.ControlKey : m_ControlKeyPressed = False
End Select
End Sub
Private Sub btnCaption_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles btnCaption.KeyDown
Select Case e.KeyCode
Case Keys.ControlKey : m_ControlKeyPressed = True
End Select
End Sub
Private Sub pnlTemplate_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles pnlTemplate.DragEnter
If m_MouseIsDown Then
If e.Data.GetDataPresent(GetType(Button)) Then
e.Effect = DragDropEffects.Move
Else
e.Effect = DragDropEffects.None
m_MouseIsDown = False
m_ControlKeyPressed = False
End If
End If
End Sub
Private Sub pnlTemplate_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles pnlTemplate.DragDrop
If m_MouseIsDown Then
If e.Effect = DragDropEffects.Move Then
Dim btn As Button = DirectCast(e.Data.GetData(GetType(Button)), Button)
Dim clientpoint As Point
clientpoint = PointToClient(New Point(e.X, e.Y))
If Not (clientpoint.X < 0 Or clientpoint.Y < 0) Then
btn.Left = clientpoint.X - pnlTemplate.Left
btn.Top = clientpoint.Y - pnlTemplate.Top
End If
m_MouseIsDown = False
m_ControlKeyPressed = False
End If
End If
End Sub
|
|
|
|
|
Hi
I created very simple dll (vc++) which has three functions (start, stop and
initialization). it starts capturing sound from soundblaster and when the
buffer is filled with the data, dll calls VB calback function (passed with
initialization) and passes the buffer size (integer type). First I have
some problems with __stdcall declaration in VC dll, but I think I solved that
problem. Callback function runs in separated thread under main dll thread.
Declaration of initialization of callback function looks like this:
__declspec(dllexport) int __stdcall RecToR_Init_Cap(void (__stdcall *tmp)(int_4 size));
IN VB:
Public Delegate Sub Callback(ByVal size As Int32)
Public Declare Function RecToR_Init_Cap Lib "RecToR_Cap_TR.dll" (ByVal CalBckFunc As Callback) As Int32
"Private Sub Button1_Click" event in VB:
Dim cb As Callback
cb = AddressOf CallBackFunc
Success = RecToR_Init_Cap(cb)
Public Sub CallBackFunc(ByVal size As Int32)
TextBox1.Text = size & vbCrLf
End Sub
When I run the application, the callback function is called 50 times and
then the application crashes:
"An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in Unknown Module. Additional information: External component has thrown an exception.
An exception 'System.NullReferenceException' has occured in..."
I think I override stack pointer. How can I trace down the problem?
From Microsoft articles I get information that I cannot call callbacks from
spawned threads within my DLL.
Is it possible to overcome this problem?
Thanks for any idea
Tomaz Rotovnik
|
|
|
|
|
Could be the garbage collector.
Try to put this code when you want to stop recording.
<br />
GC.KeepAlive(cb)<br />
I had the same problem with callback function when capturing video.
|
|
|
|
|
Hi
When the callback function is trigered 50 times I still capturing the sound.
I didn't stop sound capturing.
Do I need to call GC.KeepAlive(cb) inside the callback function?
Tomaz Rotovnik
|
|
|
|
|
The statement GC.KeepAlive is a way to keep a reference to an object.
When the garbage collector "scans" your code, and there isn’t a further reference to an object, it removes it.
E.g. the reference to your callback function is lost.
In your code….
When the recording is finished, you should call GC.KeepAlive(cb)
That way you will not loose your reference.
|
|
|
|
|
OK
Now I understand.
Unfortunately dll is still capturing when the error arrise (I didn't call stop function at all)
Tomaz Rotovnik
|
|
|
|
|
Can anyone guide me on how to make a phone answering application in vb.net. I have to start from 0.
|
|
|
|
|
How can I convert the float value to hexadecimal value using visual basic 6 ?
For example
let a = 45.36
after the conversion of 45.36, the hexadecimal value is :: 2D
can anyone please tell how to code the the coversion from float to hexadecimal value in visual basic?
Hoping for a early reply
philip
|
|
|
|
|
This question carries the stench of homework.
2D is the hexadecimal value for 45, not 45.36. Getting the hex value of any number is easy, just use the Hex() function. Note: You'll get the Hexadecimal value of the integer version of the number, not the whole floating point value.
Dim hexString As String
hexString = Hex(45.36)
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi yall
i am a student and am finding it difficult to connect to ms excel. pls assist
|
|
|
|
|
Hi ,
Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\myData.XLS; " & _
"Extended Properties=Excel 8.0;")
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from [Sheet1Name]", MyConnection)
DS = New System.Data.DataSet()
MyCommand.Fill(DS)
MyConnection.Close()
Hope This code will help u............:->
Reagrds,
Ritesh
|
|
|
|
|
Is this possible?
copy coversheet1 from test.xls in c:\test directory
paste or create coversheet1 to test2.xls in c:\test2 directory
both excel documents exist but I need to transfer a sheet from one document to the other.
I am using visual basic 6.
Any help would be greatly appreciated.
Thanks
Beginner in VB.Net
|
|
|
|
|
Roman Nurik wrote:
I am befuddled as to why API functions (I had similar problems calling ZLib DLL functions from VB.NET) don't work properly in VB.NET.
They work perfectly in VB.NET when done properly.
Without seeing more of your code, we really can't determine what's wrong. I've used the API functions myself about a year ago and never had a problem like what your having.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hey, i got it to work.. the problem was with my api declaration... the last parameter, i was declaring ByRef lpOverlapped As Overlapped... apparently that isnt right (i dont really know why) and all i did was i changed it to ByVal lpOverlapped as IntPtr and set it to zero (since i dont use overlapped)
not sure why it works, but it works
thanks for the replies
r -€
|
|
|
|
|
Glad you got it to work!
ByVal will work so long as you never pass in an OVERLAPPED structure and always pass in a 0 for this parameter. If you ever do pass in an OVERLAPPED structure, then you have to change the declaration back to ByRef lpOverlapped As OVERLAPPED and properly declare the OVERLAPPED structure in your code.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hey all. i'm a college student. in my college visual studio has a tab called "data" and under this tab are objects such as oledbconnection and other oledb and sql objects. anyways, i installed visual studio .net 2003 today (the same version thats installed in my college) and i dont see that tab at all. i tried adding the tab manually, and then adding the oledb objects to the tab, but i dont see any items at all in the oledb namespace present in the list of items i can add. however, when i open a project i did in school that has oledb objects in it, it shows up in the designer, and i can click on it, and its properties will appear in the property window and i can change them no problem like i would in school.
does anyone know what the problem could be?
|
|
|
|
|
Are you sure you don't have the Academic edition of VS? I've never seen the Academic edition, it would be cheap compared to the Profession edition. The Pro edition and above all have this tab. I'm not sure about the Academic edition.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i'm not sure if its professional or academic, but my friends have the same version and i'm the only 1 with this problem
|
|
|
|
|
Well, there are a couple of possibilities. I couldn't find anything that says there is a known problem, so, we're left with the stupid things to check.
1) The Data tab will only show up when there is a designable form selected. If your looking at a code window, the Data tab disappears.
2) Make sure that the components update ran correctly before you installed Visual Studio .NET. You might want to try downloading MDAC 2.8 from MSDN. I think the URL is http://msdn.microsoft.com/data[^].
3) Uninstall VS.NET and try reinstalling it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Basically I have a program that reads emails out of a drop directory and writes them to a SQL Table. The Program then deletes the Email with a 'File.Delete' command.
If I run this in a normal one click test app it deletes the files fine and they disapear out of the drop directory, however when I put the same code into a NTService the files do not disappear straight away and cause a problem the next time my service comes to read the drop directory.
I'm assuming that the files are marked for deletion and locked somehow.
Is this is because the file delete is a lower priority somehow in the service?
Thanks in advance.
|
|
|
|
|
P Holroyd wrote:
I'm assuming that the files are marked for deletion and locked somehow.
Is this is because the file delete is a lower priority somehow in the service?
There's no such things as being "tagged" for delete. It's either deleted or it's not. There is also no lower priority placed on deletions.
What you should be looking at is the account that the service is running under. If it's the Local System account, it's entirely possible it doesn't have the appropriate rights to delete the files. Try changing the account that the service runs under to a user account you create specifically for the service. Make sure you give this account the appropriate NTFS Security rights to the folder it needs to read/write/delete date from.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Yeah I'll try that again, I've tried giving it a different user account but it didn't seem to work. It's possible I didn't set it up right.
The files do disapear when the service stops but that's not much use to me.
I was thinking of maybe creating an exe or a dll to do the delete but would they just inherit the access rights from the service?
|
|
|
|
|
P Holroyd wrote:
The files do disapear when the service stops but that's not much use to me.
?? ?? Then you've got code/problems in there you haven't told us about. I've done this very thing myself without a problem. All I did was create a user account with the appropriate rights to the folder where all the files were copied to (log files from about 140 servers), parse those files up and dump the relevant information into an SQL Server, then delete the files.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|