|
*headsmack* Youre absolutely right.
As for your question of why... If you draw to an offscreen DC, maintain a background color (which in this case is argb(0,0,0,0)) of the DC, pass it to UpdateLayeredWindow with the right params, it will render the window for you and continue to handle the wm_paint messages that come in, until you remove the ws_ex_layered style and re-add it (in which case you need to call your fuction which draws offscreen again...). Its a great lil bit o' magic, and it allows you to have a window, for example, based on a PNG with alpha channel support.
Thanks for bringing that ANDing to my attention though!
UPDATE:
I stumbled upon an article which stated that Integers in vb.net are Longs in vb6. I had to modify the declares for SetWindowLong and GetWindowLong so that the params used Integers and returned Integers instead of Longs. Once I changed this, and used the ORing instead of the ANDing, everything worked as it should have.
Thanks again for the help guys!
|
|
|
|
|
Andrew...this is a comment to you, because we all get code blindness, but the rest of us have learned a very valuable lesson from Rage, read the code brothers, be the code. I just had the urge to assume I could grab you a quick example and let you go from there. If I had read the code properly then I too would have learned somthing 8-)
say la vee as people who talk foreign languages phonetically would say.
Chris.
Nursey
|
|
|
|
|
I am attempting to add a form or control as an object to my instance of the MSScriptControl, where the control or form will extend its events to the loaded script...
oScripting.AddObject("Window", Me, True)
oScripting.State = MSScriptControl.ScriptControlStates.Connected
That is supposed to add the object and attach its members and events... but it doesnt fire the event within the script..
Sub Window_Click()
Msgbox "clicked"
End Sub
I have also tried;
Sub Window_Click(sender, e)
Msgbox "clicked"
End Sub
Please advise! I would very much like to know what I am doing wrong!
|
|
|
|
|
Hi everyone;
I have a problem about what can I integrate a Combo box who's list is link with a table (called department) but the text of the combo is link with other table (called user).
Table 1 = user
Field 1 = User
Field 2 = DeptCode
Table 2 = Department
Field = DeptCode
Field = DeptDescription
I other words, I have a form presenting the user informtion (this information is from the table user), but the field called deptCode in user table. I want present every time the records is changed the dept description from table department.
(I think all of that is without Coding)
Please me on that...
Johnny
Johnny Lizardo
|
|
|
|
|
Hi everyone ...
When i am inside a big loop in VB6 (for .. to; if .. then; while .. wend) the form stops responding.
How can I make a stop button in the form ??
Thank you ,
Rodrigo
|
|
|
|
|
You need to provide a means to break the loop. This is an example (untested), but you should get the idea:
dim StopButtonPressed as Boolean
sub MyLongLoopSubroutine()
StopButtonPressed = false
while (MyCondition = true ) and (StopButtonPressed = false)
' do loop stuff here
' DoEvents allows the UI and other windows messages to get through
DoEvents
wend
end sub
sub StopButton_Click()
StopButtonPressed = true
end sub
Bear in mind you need to be careful when using DoEvents to keep a user interface responsive, as any actions the user has may interfere with the loop you're running.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
If anyone can give me clues on how to add an icon to the WinXP My Computer that directly access a program.
Eg... Accessing a custom FTP program like a disk drive under My Computer.
|
|
|
|
|
I have VS.NET 2002. I have developed several user controls and have a solution which contains these and a test form. When I load the solution and go to the form on which I place my controls for testing, I often get a freeze, or VS freeks out, like showing a toolbox with no controls on it, until you move the mouse all over it and get it to redraw them all, but even then it doesn't show tooltips.
I'm perfectly willing to accept that some of my code is runing in design mode and that may be freezing VS. But how do you trace code in your controls in design time? Do you have to use the old method of having two copies of VB running? One for the control and one for the form? It would make sense but I dont want to start sticking loads of trace code and making changes until I consult you guys, coz you be good!
Thanks!
Chris.
Nursey
|
|
|
|
|
I want to draw icon in CheckedListbox. May you help me.
VitaminY
|
|
|
|
|
What is the difference between Directcast and CType?
Also is it better to use CType(MyObect, Integer) than CInt(MyObject) - does it get compiled to the same MSIL or is a helper function called in the Microsoft.VisualBasic.dll?
Jim
|
|
|
|
|
While DirectCast and CType are both used for casting, DirecCast can only case object to object they have a direct relationship (ie. inheritance ) with. For example, if B inherits A, and C inherits A, you can use DirectCast to cast a C object to A.
OTOH, CType can be used to cast from any object to any object. The advantage of DirectCast is that it's much faster than CType , so use it whenever appropriate.
Looking through the IL for CType and CInt , they're actually doing the same thing, so I assume there's no difference in using either.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
|
|
|
|
|
CType is more flexible because it's not limited to converting between standard types. It can be used to convert between composite types as well as converting an object to any one of its interfaces.
CType is also compiled in-line with the expression whereas the CInt is not. CInt calls a library function to convert an already evaluated expression result whereas CType code is actually compiled as part of the expression.
Now, DirectCast... The difference between the two is that CType succeeds as long as there is a valid conversion defined between the expression and the type, whereas DirectCast requires the run-time type of an object variable to be the same as the specified type. If the specified type and the run-time type of the expression are the same, however, the run-time performance of DirectCast is better than that of CType
Consider the following code:
Dim Q As Object = 2.37 ' Requires Option Strict to be Off.
Dim I As Integer = CType(Q, Integer) ' Succeeds.
Dim J As Integer = DirectCast(Q, Integer) ' Fails.
The run-time type of Q is Double. CType succeeds because Double can be converted to Integer, but DirectCast fails because the run-time type of Q is not already Integer.
Clear as mud?
RageInTheMachine9532
|
|
|
|
|
Thanks, that is a lot clearer.
Jim
|
|
|
|
|
I have two distinct .NET applications which must interact with one another. Some information from the first one should be passed to the second.
How can i do that ?
Thanks in advance for any ideas.
Ekaterina
|
|
|
|
|
Need a bit more detail about what your doing...
What are you passing between the apps and how much?
How do these apps interact?
Do they have to interact in real-time or can they do their processing in transactions and batches?
Do you have the source for both apps?
RageInTheMachine9532
|
|
|
|
|
Looks like the kind of thing you'd use "Remoting" for...?
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
|
Duh! That would be the all-encompassing answer, wouldn't it!
My bad! Thanks!
RageInTheMachine9532
|
|
|
|
|
you could use session variables
application 1
save your value
session["id"] = txtbox1.text
application 2
read your value
dim strtest as string = session["id"]
there is another other option you could pass the value as parameter, it depends on your flow.
|
|
|
|
|
hi programmers,
i got something new in my mind... i want to hide some files or folder that are download from the internet such that they are not viewed by one, except some key combination or if he is under the admin rights for win2000/xp/NT etc.
|
|
|
|
|
How do you want to hide these files? Do you want to want to encrypt them so noone can see the contents? Do you want the files hidden in the directory, which is pretty weak security by the way...)? Need a bit more detail about what you want...
RageInTheMachine9532
|
|
|
|
|
Hello!
I have a little problem:
Example:
if I have 01/06/2003 and I want to add x months (example 3 months) and I want to obtain 01/09/2003 or to add days or years.
How I do this thing in Visual Basic .NET 2003?
Or how to convert the date to days and then to reconvert to date.
Please help me!
Sorry for my english!
Thank you!
|
|
|
|
|
Try this:
DateTime dt = DateTime.Parse("11/06/2003");
string dts = dt.AddYears(3).ToString();
|
|
|
|
|
I have a file which is seperated into fields by a comma
for each field. I am trying to read the file into some type of structure but am unable to get past the point of reading upto the comma and then
storing that away and then going back and reading the next field.
Any help would be appreciated.
|
|
|
|
|
For each line that you read in use split(',') on the string. The returned value will be an array of strings, each representing one field.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
|
|
|
|