|
You have the source code for this control, and it does not have it's own paint method ? It must have a paint handler, even if it's in a control class.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
OnPaint is an event that the control responds to. Paint is the method that the control uses to paint itself. The control itself shouldn't be firing off an OnPaint event.
Like Christin asked, do you have the source for this control? And are you creating your own version of this control?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you Dave.
I'm using a suite of free controls downloaded from www.Softwire.com. There are very interesting things there. You can use this controls programmaticaly or graphicaly connecting one to each other.
I'm using it programmaticaly for example
Dim WithEvents myStripChar as new Softwire.VI.Stripchart
...
For i=0 to 100
myStripChart.value = i
myStripChart.Operate()
Next
That's all code necesary to run something basic.
So, I wanted modify it adding a vertical line to the control and I thought to do it overwithing the OnPaint event, But it never happened.
Thanks a lot
german
|
|
|
|
|
Does any one have code examples of implementing the IBindStatusCallback class / methods of URLMON URLDownloadToFile API call?
Thanks
Jack
Thanks
Jack
|
|
|
|
|
I'm trying to write my own save dialog (to replace the one in word 2003) but I'm unsure of how to go about it. I haven't found very much information about this topic on the internet so I'd be grateful for any information...
/jason
|
|
|
|
|
You can't "hook" the dialog and really can't replace it. Why do you want to change the Save dialog in Word?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to intercept the message calling the Save Dialog and instead, open my own. Is this really an impossibility? The reason I am doing this is that I'm involved in a document management system and we want to prevent the user from doing certain things and allow them to do others.
/jason
|
|
|
|
|
This is not impossible by any means, at least not up through Word 2002 anyway. I know nothing about Word 2003 but I would assume it still supports Automation.
I have written something similar to what you describe - basically a document management type of application. We had documents that were stored on a remote server, users opened documents from a web page, and edited them using their local Word instance. Then we needed to trap the user save events in order to preserve the document names as well as launch an FTP transfer to automatically send the modified document back to the remote server.
Basically what you have to do is get the active instance of Word, and then sink the events in your application.
Word fires a DocumentBeforeSave event when the user attempts to save the document. If you set the SaveAsUI property to false in this event, it will suppress the Word Save Dialog. Then you add your custom code to control how the document is saved.
That part is simple enough.
There are some caveats:
1) If you always launch Word from your document control application, then you always have the reference and can sink events. But depending on your system, you may have to account for the possibility of a user launching Word itself then editing a controlled document. So your application may need to run all the time, and poll the system frequently to see if Word has been launched externally.
2) Again depending on your system, it may be possible for people to circumvent your controlled environment by copying/and or renaming controlled documents outside of Word - i.e using Windows Explorer. Obviously if you need to save a doc, users will have read/write access. So you cannot easily enforce this by file system permissions.
You can trap this by using another feature of Word Automation object model. Documents provide a generic Variables collection. You can create your own variables that you can control by your code. For example, suppose you need to prevent a user from copying a document from Windows Explorer into a new file name and then editing it in Word. Embed the document name in a custom Document.Variable. When the user opens a document, you compare the file name to the embedded name, and if they don't match, act as you deem fit - i.e forcibly rename the document, close it as "corrupt", whatever.
3) This is MOST important: People use Word for a variety of reasons, and it is almost certain that only some documents will actually fall within the scope of your document control system. (A private memo to Personnel, for example, is after all private and not only do you probably not want such docs to find their way into your managed document group, it could potentially result in a lawsuit. Plus in this mercernarial world we live in, should people really be prevented from polishing up their resume on their lunch hour? LOL!! I don't think so...
With an ubiquitous application like Word, you definitely need a way to determine if any given document is not part of your managed collection. In which case, your custom code should not run, but rather should allow the standard Word functionality to be re-established.
You accomplish this also by use of embedded variables. You sink the events for all documents, but you should check for the presence or absence of some custom embedded variable in the document to differentiate between a managed document versus an unmanged document, and run or abort your custom actions accordingly.
4) etc etc..
To make a long story short, tapping into the Word interfaces and implementing a custom save action is not the difficult task.
Making sure that your system reliably manages documents which require management, and not only ignores but also does not interfere at all with documents that are not part of a managed group is the real chore.
Designing an effective system will require some thought, and quite a bit of testing as well. Users can be very unpredictable...
Hope this helps,
Robert
|
|
|
|
|
I think I'll bow out of this one gracefully!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This is what I'm talking about! Thanks for this Robert, it helped organise our thoughts on this process. What we have decided to do is implement an activeX control that hides the existing save button, and display our own in it's place, while leaving the Save As button in place. Our save button then saves the document to our DMS while the Save As button allows them to save documents with the usual interface. We're happy enough with this solution because it allows us to use the same ActiveX control for the Office Suite (Word, Excel, Powerpoint and Visio)
Thanks for your tips
/jason
|
|
|
|
|
|
Hi. i wanna create my component. how i can this. please help me.
|
|
|
|
|
Black magic.
If you want a different answer, try telling us what it is you're trying to do.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
i want writing my control. how i do.
Mustafa GUNES
Osmangazi University
The Department of Computer And Instructional Technology in Education
|
|
|
|
|
i want writing my control. how i do.
|
|
|
|
|
I'd suggest that you forget about it for now. I still have no idea what you want. You want to write a control. I have no idea what it does, so all I can tell you is to derive from a base control class. It looks to me like you're a few steps short of knowing enough about software development to be thinking of writing anything.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I would like to know is there a way to have a script that will change the order of registry data?
What I need to have is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Linkage\Bind
Which is REG_EXPAND_SZ type
I need to have \Device\NdisWanIp entry move to the top without modifying any of the other unique data lines.
Is this possible with WMI or any other type of scripting.
|
|
|
|
|
It's a REG_MULTI_SZ, not an expand type.
You'll have to read the string value that's stored into an array of strings, then reorder the array using standard array methods, and write then value back out. The WMI StdRegProv Provider will work with Multi_Sz values.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Trying to see if anyone can convert the code from Robert Rohde from C# into VB.net. This is an awsome kluge for the missing default view property in a file dialog box.
http://www.codeproject.com/cs/miscctrl/FileDialogExtender.asp?msg=1042669#xx1042669xx
Im really weak when it comes to this kind of programming. Looks like it should be fairly easy, and MANY people are looking for this it seems. Anyone feel like taking the adventure? I would love to see this thing work for me as a function or something.
Heck.. I'd settle for someone to walk me through making and calling the .dll too
Kudos to Robert Rohde!
David M. Levine
|
|
|
|
|
You found the easy way to do it. Try converting the code yourself. If you get stuck, search the web for C#/VB.NET translators. They're out there and their as easy to use as copying and psting sections of code, like a subroutine from one language to another.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I keep running into errors due to the preprocessor... namespace vs. class and whatnot.
|
|
|
|
|
I did not extensively test or refine this code. It works on my machine - Win2K NET 2002.
There is minimal error handling. I mostly just translated the original C# code referenced into VB.
This should get you started...
Robert
Extender Class Code:
*****************************************************************************************
Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Public Class CFileDialogExtender
Public Enum DialogViewTypes_enum
Icons = 28713
List = 28715
Details = 28716
Thumbnails = 28717
Tiles = 28718
End Enum
Private Const WM_COMMAND As Integer = 273
Private Const WM_ENTERIDLE As Integer = 289
Private m_hwndLastDialog As IntPtr
Private m_DialogViewType As DialogViewTypes_enum
Private m_fEnabled As Boolean
'Declaration for the FindWindowEx API
Private Declare Auto Function FindWindowEx Lib "user32" _
(ByVal hwndParent As IntPtr, _
ByVal hwndChildAfter As IntPtr, _
ByVal lpszClass As String, _
ByVal lpszWindow As String) _
As IntPtr
'Declaration for the SendMessage API. Note last parameter is declared as string
Private Declare Auto Function SendMessage Lib "user32" _
(ByVal hwnd As IntPtr, _
ByVal wMsg As Integer, _
ByVal wparam As Integer, _
ByVal lparam As String) _
As Integer
Public Property DialogViewType() As DialogViewTypes_enum
Get
DialogViewType = m_DialogViewType
End Get
Set(ByVal DialogViewType As DialogViewTypes_enum)
m_DialogViewType = DialogViewType
End Set
End Property
Public Property Enabled() As Boolean
Get
Enabled = m_fEnabled
End Get
Set(ByVal Enabled As Boolean)
m_fEnabled = Enabled
End Set
End Property
Public Sub WndProc(ByRef m As Message)
Dim RetVal As Integer = 0
Dim hwndChildAfter As IntPtr = IntPtr.Zero
If Not m_fEnabled Then
Exit Sub
End If
If (m.Msg = WM_ENTERIDLE) Then
Dim hwndDialog As IntPtr = m.LParam
If (hwndDialog.ToInt32 <> m_hwndLastDialog.ToInt32) Then
'get handle of the listview
Dim hwndListView As IntPtr = FindWindowEx(hwndDialog, hwndChildAfter, "SHELLDLL_DefView", "")
'send message to listview
'This will throw an error if the style is not supported on current OS!
'For example Win2k does not support "Tiles" view
Try
RetVal = SendMessage(hwndListView, WM_COMMAND, m_DialogViewType, 0)
Catch
'Do nothing
End Try
'remember last handle
m_hwndLastDialog = hwndDialog
End If
End If
End Sub
End Class
******************************************************************************************
Typical calling code:
******************************************************************************************
Public Class Form1
Inherits System.Windows.Forms.Form
'The FileDialogExtender object MUST be initialized because it processes messages
'from the forms WndProc override!
Private m_FileDialogExtender As New CFileDialogExtender()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ShowFileDialog()
End Sub
Private Sub ShowFileDialog()
Dim intResult As Integer
m_FileDialogExtender.Enabled = True
m_FileDialogExtender.DialogViewType = CFileDialogExtender.DialogViewTypes_enum.Icons
Dim oFileDialog As New OpenFileDialog()
Try
intResult = oFileDialog.ShowDialog
'If an error occurs it is because style is not supported
Catch
'Reset style to standard listview and show again
m_FileDialogExtender.DialogViewType = CFileDialogExtender.DialogViewTypes_enum.List
oFileDialog = New OpenFileDialog()
intResult = oFileDialog.ShowDialog
End Try
'Process dialog results here
MessageBox.Show(oFileDialog.FileName.ToString)
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
m_FileDialogExtender.WndProc(m)
End Sub
End Class
******************************************************************************************
|
|
|
|
|
Absolutly awsome! Everything works like VB should have been in the first place. Thanks to all!
David M. Levine
:->
|
|
|
|
|
Does anyone know of a way to add a suffix to a vb variable based on another variables content?
I have a variable that is global named "LineNumber" and would like to append it to the end of a variable named "Line" in the Dim.
Exaple:
Private LineNumber as integer
private sub AddNumber()
dim Itm as new combobox
end sub
I would like to append the contents of "LineNumber" to the "Itm" name on the Dim statement.
regards
"The things that will destroy us are: politics without principle; pleasure without conscience; wealth without work; knowledge without character; business without morality; science without humanity; and worship without sacrifice."
-Mahatma Gandhi (1869-1948)
|
|
|
|
|
jose.hernandez@systems-programmer.com wrote:
know of a way to add a suffix to a vb variable based on another variables content
??? WHAT ???
Are you asking this:
Private LineNumber As Integer = 506
Private Sub AddNumber()
Dim Itm506 As New ComboBox
End Sub
You can't.
What are you really trying to do with this?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|