|
See GetThreadTimes() API.
onwards and upwards...
|
|
|
|
|
Thank you very much .
Your guide is very good .
|
|
|
|
|
That's what the szInstanceName member of PDH_COUNTER_PATH_ELEMENTS is for. The threads (instances) are 0-based. See my response here. Change szObjectName to "Thread", assign szInstanceName a value, change szParentInstance to the name of the process that has the threads.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks a'lot for your guide .
|
|
|
|
|
It appears to me that IE, if challenged by a web server for authorization will send my current username/password and try and authorise me with those before asking for another username/password.
Is there something I can get obtain from the system to authorise a user with without having to ask for and supply the username/password? It looks like C# has something along these lines in CredentialCache.DefaultCredentials, but I need pure Win32 methods.
|
|
|
|
|
i have created a VC++ application. The .exe depends on few dlls. one of them is MSJET35.dll. i converted the dll into MSJET35.lib. now, i want to statically link this library with my exe so that it runs independently on any machine irrespective of the presence of MSJET35.dll. but i do not know how to link statically with a library. need help, suggestions on this matter
|
|
|
|
|
You can't convert a DLL to a static lib without the source code. Most likely, you've succeeded in creating an import lib for the DLL. MSJET32.DLL sounds like a MS ODBC-DLL, there's no chance you'll ever be able to link it statically to your app
|
|
|
|
|
HI~
How to search a substring from LPWSTR?
Also I cannot extract a character like string class
e.g
I cannot do this:
LPWSTR a_string = _T("abcdef")
if (a_string[2] == 'c'){...}
How to extract a character is the string is LPWSTR type?
Thanks
|
|
|
|
|
LPWSTR a_string = _T("abcdef");
if (a_string[2] == (WCHAR)'c'){...}
...Plug & Pray...
|
|
|
|
|
Dimitris Vassiliades wrote:
(WCHAR)'c'
Actually the correct syntax is L'c' for wide-char literals. (Your code will work but I didn't want the original poster to get the idea that casts are the solution for string-related stuff.)
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Actual sign at the laundromat I go to: "No tinting or dying."
|
|
|
|
|
LPCTSTR SubString( LPCTSTR lpExpression, // [in] Pointer to a string to extract the substring from
ULONG nStart, // [in] Starting point
LONG nLength = -1 ) // [in] how far to go from the startig point, use -1 to go the end of lpExpression
{
if( nLength < 0 )
nLength = strlen(lpExpression) - nStart;
ULONG nPos = 0;
PTCHAR lpResult = new TCHAR[512];
for( ULONG i = nStart; i < (ULONG)(nStart+nLength); i++ )
{
// put the current char from lpExpression into lpResult
lpResult[nPos++] = lpExpression[i];
}
// add the null byte to lpResult;
lpResult[nPos] = '\0';
// return the substring
return lpResult;
}
|
|
|
|
|
Hi,
i m recving data from bar code reader ,, on Socket
In which format a bar code reader send data ..
i m not properly formating it.
2 .... as to format integer
CString s;
int value
DWORD dval
s.Foramt( "%d" , value);
wt i will use for DWORD in place of "%d" in format
thanx
|
|
|
|
|
INT_PTR nResponse = dlg.DoModal();
return -1 if when i add a custom control using resource editor.
how can i solve this?
|
|
|
|
|
Probably the window class for custom control is not registered before DoModal call. Are you trying to call RegisterClass in OnInitDialog?
Tomasz Sowinski -- http://www.shooltz.com
Alika masiaka!
|
|
|
|
|
Hi all
I have a little problem. I am using ADO to connect to a database, I have managed to add records to this db, but when I want them displayed the recordset is empty, what am i doing wrong?
Is it possibly because access 2000 has limitations on the amount of fields you can view?, Is it because ADO has limitations on the record set?, I have even copied working code from another program and still the record set is blank!
Here is the code:
<br />
void CViewRptDlg::OnShowReport()<br />
{m_strConnection = _T("DSN=Report_prg");<br />
m_strCmdText = _T("Select * From R_tbl where MonthName='"+CString(m_strMonth)+"' and WardNumber='"+CString(m_strWard)+"'");<br />
m_pConnection = NULL;<br />
m_pCommand = NULL;<br />
m_pRs = NULL;<br />
m_piADORecordBinding = NULL;<br />
::CoInitialize(NULL);<br />
<br />
try<br />
{<br />
<br />
m_pConnection.CreateInstance(__uuidof(Connection));<br />
m_pCommand.CreateInstance(__uuidof(Command));<br />
m_pRs.CreateInstance(__uuidof(Recordset));<br />
m_pRs->Open(LPCTSTR(m_strCmdText),LPCTSTR(m_strConnection),adOpenDynamic,adLockOptimistic,adCmdUnknown);<br />
if(FAILED(m_pRs->QueryInterface(__uuidof(IADORecordBinding),(LPVOID*)&m_piADORecordBinding)))<br />
_com_issue_error(E_NOINTERFACE);<br />
m_piADORecordBinding->BindToRecordset(&m_rsRecSet);<br />
RefreshBoundData(); <br />
}<br />
catch(_com_error &e)<br />
{<br />
GenerateError(e.Error(),e.Description());<br />
}<br />
<br />
void CViewRptDlg::RefreshBoundData()<br />
{<br />
CCustomRs *pRs = GetRecSet();<br />
<br />
if(adFldOK == pRs->lReportIDStatus)<br />
m_nReportID = pRs->m_nReportID;<br />
else<br />
m_nReportID = 0;<br />
if(adFldOK == pRs->lMonthNameStatus)<br />
m_strMonth = pRs->m_szMonthName;<br />
else<br />
m_strMonth = _T("");<br />
if(adFldOK == pRs->lWardNumberStatus)<br />
m_strWard = pRs->m_szWardNumber;<br />
else<br />
m_strWard = _T("");<br />
UpdateData(0);<br />
}<br />
|
|
|
|
|
i want to limit the entry size in the edit-box. How do i do? secondly, I want to enter only numbers and special characters into my edit, no characters. how do i change it?
|
|
|
|
|
|
See the EM_LIMITTEXT message.
onwards and upwards...
|
|
|
|
|
Can anyone point me to an example of an MFC owner drawn window? (That does NOT use a remake of CDialog class)
|
|
|
|
|
Hi,
I just want to add a cool feature to my application: creation of pdf documents from data in a listview control. However, pdf is a binary format, and therefor not as straightforward to create as for example html.
Does anybody know of a free (maybe open-source?) library that works under Visual C++, to create simple pdf files?
Thank you,
Erik
|
|
|
|
|
I think PDFlib Lite is free for personal use.
Visit www.pdflib.com and look for PDFlib lite.
Regards
|
|
|
|
|
Well, I am a newbie programmer.
I need help with a lil project I am making.
Lets say I have this button called increase, when I press this button I want it to add 1 to the variable x, and display the changes.
So under the button "OnIncrease",
I chose and put the command
x++;
Which lets me add 1 to the variable x which is an unsigned long. Once this button is clicked, I want to also make it display in the box called "OnList"
which is a list box.
Can anyone explain simply how to make it say, "You have "x" dollars in your account."
Thanks,
make sure it is simple for me to understand.
Arun
|
|
|
|
|
CString str;
CString output;
str.Format("%i", x);//make a string from your number
output = "You have \"" + str + "\"dollars in your account.";//make nice ans fluffy string. (\" is a " character in your string)
listbox.Add(output);//add to listbox (could be AddString or something don't know by heart)
hope this helps.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I tried implementing your code and I got errors.
Do you think you can manually explain it?
What did you mean make nice ans fluffy string?
I get these errors -_-
F:\Documents and Settings\Administrator\My Documents\Arun\Code\Tycoon\TycoonDlg.cpp(107) : error C2065: 'listbox' : undeclared identifier
F:\Documents and Settings\Administrator\My Documents\Arun\Code\Tycoon\TycoonDlg.cpp(107) : error C2228: left of '.Add' must have class/struct/union type
F:\Documents and Settings\Administrator\My Documents\Arun\Code\Tycoon\TycoonDlg.cpp(107) : error C2065: 'output' : undeclared identifier
This is the code from my file.
void CTycoonDlg::OnIncrease()
{
cash++;
//On Click, Display in ListBox "You currently have $(cash) with you."
CString str;
CString output;
str.Format("%i", cash);//make a string from your number
output = "You have \"" + str + "\"dollars in your account.";//make nice ans fluffy string. (\" is a " character in your string)
}
void CTycoonDlg::OnList()
{
listbox.Add(output);//add to listbox (could be AddString or something don't know by heart)
}
I know I said "x" would be the variable, but I decided it was too confusing and changed it to "cash".
|
|
|
|
|
arunforce wrote:
What did you mean make nice ans fluffy string?
Nothing actually, crazy developers like myself often set crazy comment to try and be funny.
ok, CString output is declared LOCAL in your case. Put it in your .h file or somewhere on top of your .cpp file. (but under the include part)
"listbox" is an unknown Object (or variable) in your case.
go to the resources, right click your list box and choose "add member variable". Name it and use this name instead of "listbox"
output = "You have \"" + str + "\"dollars in your account."
make it:
output = "You have " + str + " dollars in your account.";
then you don't have the " in your text.
try this and you'll get less errors.
btw: I explained it taken in account you have Visual Studio. If you don't, you have to create your listbox manually. =>( http://msdn.microsoft.com[^] search on CListBox)
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|