|
http://nehe.gamedev.net/[^] is the best GL site. They have C# versions, I assume a VB.NET port would be easy enough.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Another dimension it is!
Thanks a lot.
Marvin N. Guerrero
- Taje Kage_bunshinNunJutsU
|
|
|
|
|
Hi dear all,
In an attempt to tweak Microsoft word, I would need to choose programmatically a certificate (with filters on the signer.name, Certificate.issuer and certificate.expiration.date) from the dialogbox selectcert which pops up when adding this code within a vba routine :
dim sig as signature
set sig = activedocument.signatures.add
I have seen some infos in selectcert structure at msdn but cannot figure out how to achieve the proper hook. (ideally as well I could bring the proper timestamp to digitally sign (which actually is the local time by default ) If any of you knows how to achieve it (Code snippet is a must) you are very welcome.
MSDN Home > MSDN Library > Win32 and COM Development > Security > Cryptography > Cryptography Reference > Cryptography Structures
Platform SDK: Cryptography
CERT_SELECT_STRUCT
The CERT_SELECT_STRUCT structure contains criteria upon which to select certificates that are presented in a certificate selection dialog box. This structure is used in the CertSelectCertificate function.
typedef struct tagCSS { DWORD dwSize; HWND hwndParent; HINSTANCE hInstance; LPCTSTR pTemplateName; DWORD dwFlags; LPCTSTR szTitle; DWORD cCertStore; HCERTSTORE* arrayCertStore; LPCSTR szPurposeOid; DWORD cCertContext; PCCERT_CONTEXT* arrayCertContext; DWORD lCustData; PFNCMHOOKPROC pfnHook; PFNCMFILTERPROC pfnFilter; LPCTSTR szHelpFileName; DWORD dwHelpId; HCRYPTPROV hprov;
} CERT_SELECT_STRUCT, *PCERT_SELECT_STRUCT;
Members
dwSize
The size of this structure in bytes.
hwndParent
The handle to the parent window of any dialog boxes that CertSelectCertificate generates.
hInstance
The handle to the module whose executable file contains the dialog box template.
pTemplateName
If the CSS_ENABLETEMPLATE flag is set in the dwFlags member, set pTemplateName to a pointer to a global memory object that contains the template that DialogBoxIndirectParam uses to create the dialog box. A dialog box template consists of a header that describes the dialog box. The header is followed by one or more additional blocks of data that describe each of the controls in the dialog box. The template can use either the standard format or the extended format.
If the CSS_ENABLETEMPLATEHANDLE flag is set in dwFlags, pTemplateName specifies the dialog box template. pTemplateName is either the pointer to a null-terminated character string that specifies the name of the dialog box template or an integer value that specifies the resource identifier of the dialog box template. If the specifies a resource identifier, its high-order word must be zero and its low-order word must contain the identifier. One way to create this integer value is to use the MAKEINTRESOURCE macro.
dwFlags
This member can be one or more of the following values.Value Meaning
CSS_HIDE_PROPERTIES Hide the Properties button.
CSS_ENABLEHOOK Pass a hook procedure in pfnHook.
CSS_ALLOWMULTISELECT Enable multi-selection of certificates.
CSS_SHOW_HELP Show the Help button.
CSS_ENABLETEMPLATE Cause CertSelectCertificate function to call the DialogBoxIndirectParam function to create a dialog box. For more information, see pTemplateName.
CSS_ENABLETEMPLATEHANDLE Cause the CertSelectCertificate function to call the DialogBoxParam function to create a dialog box. For more information, see pTemplateName.
szTitle
A pointer to a string that contains the text for the title of the dialog box.
cCertStore
The number of certificate store handles in arrayCertStore.
arrayCertStore
A pointer to the array of certificate stores that the dialog box enumerates and displays.
szPurposeOid
A pointer to a string representation of an object identifier (OID) for an enhanced key usage (EKU). If an OID is provided, only certificates that include this EKU will be displayed.
cCertContext
The number of certificates in the arrayCertContext member.
arrayCertContext
A pointer to an array of CERT_CONTEXT structures. The certificates represented by these structures are selected when the dialog box displayed by the CertSelectCertificate function initially appears.
lCustData
A pointer to an array of byte values that hold custom data that is passed through to the filter procedure referenced by pfnFilter. This custom data is not used by the CertSelectCertificate function.
pfnHook
A PFNCMHOOKPROC function pointer to the Hook callback function. This function is called before messages are processed by the dialog box. For more information, see Hooks.
pfnFilter
A PFNCMFILTERPROC function pointer to the filter callback function. This is called to determine which certificates will be displayed by the dialog box.
szHelpFileName
A pointer to a null-terminated string that contains the full path to the Help file.
dwHelpId
The context identifier for the topic. For more information, see WinHelp.
hprov
A handle to the Cryptographic Service Provider (CSP) to use for certificate verification.
Requirements
Client Requires Windows "Longhorn", Windows XP, or Windows 2000 Professional.
Server Requires Windows Server "Longhorn", Windows Server 2003, or Windows 2000 Server.
Header Declared in CryptDlg.h.
Unicode Implemented as CERT_SELECT_STRUCT_W (Unicode) and CERT_SELECT_STRUCT_A (ANSI).
Best regards
herve cadieu
|
|
|
|
|
I have been trying for a week now to use VBA to send commands to cmd.exe input buffer. I've been able to send text to its screen buffer using writeconsole and writefile along with the std_output_handle. But whenever i use writefile with the std_input_handle it doesnt write any bytes. Also, i'm having trouble figuring out writeconsoleinput, because of the INPUT_RECORD datatype. Basically, i dont know how to create an INPUT_RECORD datatype, along with a KEY_EVENT data type in VBA.
Any help on how to use these functions would be great. here is what i have for writefile:
Private Const STD_ERROR_HANDLE As Long = -12&
Private Const STD_INPUT_HANDLE As Long = -10&
Private Const STD_OUTPUT_HANDLE As Long = -11&
m_StdInput = GetStdHandle(STD_INPUT_HANDLE)
m_StdOutput = GetStdHandle(STD_OUTPUT_HANDLE)
i = m_StdInput
WriteFile(i, ByVal Text, Len(Text), BytesWritten, ByVal 0&)
This works when i substitute m_StdOutput for 'i', but not for m_StdInput.
finally, this is for a program that askes for a username/password in sequence after being called from cmd.exe. I want to find a way of inputing the username/password. Ive tried redirecting with <, but that only works for the username.
Any suggestions/help would be greatly appreciated!
Nik
|
|
|
|
|
:(Hi,
I would like view the remote system files and select some of them for processing, similar to OpenFileDialog box for local/network files. I downloaded the FTP Client from www.enterprisedt.com, and it works great for uploading and downloading files by providing path. How can I browse the files?
Thanks
|
|
|
|
|
I think an FTP Client already had ability of browsing files on FTP server
so just select file and download it to process
is it ur mean?
<< >>
|
|
|
|
|
I'm looking for a way to countdown between two dates which will yeild "Years" "Months" Weeks" and "Days" to go.
EG(10/22/2005 to 10/26/2005 would yeild "0 Years" "0 Months" "0 Weeks" and 4 Days")
Been playing with datediff, dateadd and can't seem to find a way.
Any help would be appreciated.
Regards
|
|
|
|
|
Check out TimeSpan. It should provide you with the information you need.
|
|
|
|
|
Checked it out. Doesn't seem to do the trick. It will return in days but I need to count down.
IE(10/22/2005 to 11/22/2006 is 1 year 1 month 0 weeks and 0 days)
|
|
|
|
|
You can easily do this with just DateDiff and DateAdd.
Just create a function that first calculates the difference in years using DateDiff. Subtract that value from the original End date using DateAdd. Then calculate the difference left in months from the new temp End Date. Subtract that value from the new temp date to recalculate a new value for the temp end date, which should now only be different by days. Take the days left and split them into weeks and residual days left.
|
|
|
|
|
im_hoser...
The message displayed at the end of the below code displays the correct 2 years, 8 months, 2 weeks and 3 days. The only protection missing is checking, before this code is executed, whether or not the from date is after the to date; but, I'm sure you have that covered already.
This looks like a very useful routine. Think I'll put it into a Double Text library so I have it whenever I need it.
George
Dim Years As Integer
Dim Months As Integer
Dim Weeks As Integer
Dim Days As Integer
'** Create a couple of dates to play with
Dim TempDate As Date ' Working date
Dim FDate As Date = Now ' The first, or from date
Dim LDate As Date = DateAdd(DateInterval.Year, 2, FDate)
LDate = DateAdd(DateInterval.Month, 8, LDate)
LDate = DateAdd(DateInterval.Day, 17, LDate) ' The last, or to date
'** Determine the number of years in the interval
Years = DateDiff(DateInterval.Month, FDate, LDate)
Years = (Years - (Years Mod 12)) / 12
'** Advance the first date up by the number of years
FDate = DateAdd(DateInterval.Year, Years, FDate)
'** Determine the number of whole months
'** Calculate the raw number of months
Months = DateDiff(DateInterval.Month, FDate, LDate)
'** Set up a temporary date that is the first date advanced by
'** the number of raw months
TempDate = DateAdd(DateInterval.Month, Months, FDate)
'** If the raw number of months is too many, back off by 1 month
If DateDiff(DateInterval.Day, TempDate, LDate) < 0 Then
Months -= 1
End If
'** Advance the first date by the number of months
FDate = DateAdd(DateInterval.Month, Months, FDate)
'** Determine the number of weeks and days
Weeks = DateDiff(DateInterval.Day, FDate, LDate)
Days = Weeks Mod 7
Weeks = (Weeks - Days) / 7
MsgBox(Years & ControlChars.CrLf & _
Months & ControlChars.CrLf & _
Weeks & ControlChars.CrLf & _
Days & ControlChars.CrLf)
|
|
|
|
|
im_hoser...
As part of preparing this code for saving in a Double Text library, I reworked it a bit. It's should now be more accurate. If you would prefer the revised code, please download this text file from my web site.
http://www.2goodsoftware.com/snippets/intervalcalc.txt
|
|
|
|
|
Thanks George. Very nice code.
|
|
|
|
|
Does anyone know a good way to install an application on a remote computer. Our company has 4 locations and right now I am having to remote desktop in to each to load updates. I was wondering if there was a installation utility or code for one that allows you to install an app on remote computers from a central location.
Jim
Jim Wilcox
|
|
|
|
|
|
hellow to all..
i am writeing a code that works on database in sqlserver ..
i wrote the following code
Dim sSQL As String
sSQL = "Select * From Cities"
Try
conSQL.Open()
Dim MyDataReader As SqlClient.SqlDataReader
Dim MySqlCommand As SqlClient.SqlCommand
Dim MyDataSet As DataSet = New DataSet
Dim MySqlDataAdapter As SqlClient.SqlDataAdapter
MySqlDataAdapter.SelectCommand = New SqlClient.SqlCommand(sSQL,conSQL)
MySqlDataAdapter.Fill(MyDataSet)
MySqlCommand.Connection = (conSQL)
MySqlCommand.CommandText = sSQL
MyDataReader = MySqlCommand.ExecuteReader
Do While MyDataReader.Read
cmbCity.Items.Add(MyDataReader(0))
Loop
MyDataReader.Close()
conSQL.Close()
conSQL.Dispose()
i get the following error
"Object refrence not set to an instance of an object"
thank's for the help ..
|
|
|
|
|
The problem is with "MySqlCommand".
You need to have it reference an object before using it.
|
|
|
|
|
u mean to make it like this ?
Dim MySqlCommand As SqlClient.SqlCommand = New SqlClient.SqlCommand
|
|
|
|
|
Right. But from the looks of things, your code needs to be cleaned up a bit more.
First of all, you're trying to execute the same SQL command twice. Was this the intent? (I don't think so.)
You're reading it once here...
MySqlDataAdapter.SelectCommand = New SqlClient.SqlCommand(sSQL,conSQL)
MySqlDataAdapter.Fill(MyDataSet)
And the other here...
MySqlCommand.ExecuteReader
I think you should get rid of the Adapter and DataSet and stick to MySqlCommand since I didn't see your code really using them anyways. Also, you need to dispose MySqlCommand and its DataReader once you're done using them. Not doing so would cause a database connection "leak" (for a database like Access, there are only a finite number of connections that can be made so this is important). Dispose them before you dispose the connection.
[edit]
Oops. I just noticed that you are closing the DataReader. You just need to dispose the MySqlCommand then.
[/edit]
-- modified at 15:04 Wednesday 26th October, 2005
|
|
|
|
|
that's great ..
thank u for ur support
|
|
|
|
|
Hi,
I need a hand. What I need to do is to read a word from a file (this I can do). Then I need to get my program to remove all duplicates from the word. After that I need to load that into a string of textboxes and then to add the alphabet starting from the last letter of the word.
e.g
1. Load the word mememe
2. Strip the duplicates so the final word would be me
3. Insert into textboxes and add alphabet e.g mefghijklnopqrstuvwxyzabcd
Thanks in advance
Stevelam
|
|
|
|
|
Steve...
You didn't specify in the specs whether or not the removal of duplicate letters, and the appending of the alphabet was to be case sensitive. The functions I wrote are both case sensitive.
Download this Visual Studio project from my web site.
http://www.2goodsoftware.com/snippets/duplicate letters.zip
When you run the project in VS, type any string into the textbox and click the button (neither control is appropriately named or initialized since the project is just a test bed). The modified string will be displayed in a message box.
There are two functions ... RemoveDupLetters and AddAlphabet. Copy both functions and paste them into a module (for global scope) in your project.
If I can be of further help, please let me know.
George
|
|
|
|
|
Thats great, thanks. The only problem is the fact that if I put in hello it gives me helopqrstuvwxyz but really I could do with helopqrstuvwxyzacbdfgijkmn
Thanks again for the quick responce.
Steve
|
|
|
|
|
I though the idea was to remove duplicate letters ... as in the second L in hello? Mayhe I missed something. Anyway, your welcome.
|
|
|
|
|
Sorrry I should have said that I needed the whole alphabet in the end, just that it started after the last letter and didnt have any duplicates. Hope you can help. Thanks once again.
Steve
-- modified at 14:35 Wednesday 26th October, 2005
|
|
|
|