|
The IDS_STR value that you've to provide for LoadString() is not string. Its an #define for UINT .
For instance if the id of your string in string table is IDS_STR_MYSTRING , then you can call it like,
strLable[iLabel].LoadString( IDS_STR_MYSTRING );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I need to load array of strings.
IDS_STR_610 A1
IDS_STR_611 A2
IDS_STR_612 A3
;;;
'''
IDS_STR_624 A24
thes string i need to load in an CString array
strLable[10].LoadString(IDS_STR_610);
strLable[11].LoadString(IDS_STR_611;
strLable[24].LoadString(IDS_STR_624);
|
|
|
|
|
If those strings are declared serially in resource table, then you can loop and add, for instance,
UINT StringID = IDS_STR_610;
UINT EndStringID = IDS_STR_624;
while( StringID != EndStringID )
{
CString csMessage;
csMessage.LoadString( StringID );
++StringID;
}
This will work only if the strings are serially in string table. So take care.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
Why don't you report the problem in the article message board (at the bottom of the article) ?
|
|
|
|
|
Hi everyone.. I'm having a problem using lists in C++. I'm using Visual Studio 2008 express.
This is the output of build:
c:\programas\microsoft visual studio 9.0\vc\include\list(937) : error C2679: binary '==' : no operator found which takes a right-hand operand of type 'const Band' (or there is no acceptable conversion)
c:\documents and settings\francisco\os meus documentos\visual studio 2008\projects\band_manager\band_manager\band.h(44): could be 'bool Band::operator ==(const std::string &)'
while trying to match the argument list '(Band, const Band)'
c:\programas\microsoft visual studio 9.0\vc\include\list(927) : while compiling class template member function 'void std::list<_Ty>::remove(const _Ty &)'
with
[
_Ty=Band
]
c:\documents and settings\francisco\os meus documentos\visual studio 2008\projects\band_manager\band_manager\manager.h(26) : see reference to class template instantiation 'std::list<_Ty>' being compiled
with
[
_Ty=Band
]
The problem is when i try to use the remove():
void Manager::remove_band(const Band & bd)
{
available_bands_list.remove(bd);
}
I think I have the operator overloading right:
bool Band::operator == (const string & text)
{
return name == text;
}
Can anyone help me please?
Thank you!
|
|
|
|
|
FrankMookie wrote: I think I have the operator overloading right:
Not really no: your operator receives a std::string and the list will compare Band objects. So you need to provide an operator which receives a Band:
bool Band::operator == (const Band& other)
|
|
|
|
|
thank you so much for your help! It worked.
|
|
|
|
|
Hi all,
I am making an updating system for several softwares, now what I want to do is that my updating system should be able to download updates simultaneously. I have all the download functions sorted out I just dont know how to do the multiple downloads. Please advise me on what to do. This is my function btw:
bool DownloadFile(Updates* prd)
{
bool result = false;
DownloadThread((void*)prd);
return result;
}
Thanks,
Jayjay
|
|
|
|
|
May be your code is working correctly but why do you return false everytime. What is the implementation for DownloadThread?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi,
Yes its working correctly I have no problems with it whatsoever I just want to know how to implement multithreading. DownloadThread is just a function that downloads from a link.
thanks,
Jayjay
|
|
|
|
|
You can start two or n number of threads. I don't think you would need to synchronize the threads, you can call the function with different parameters to allow downloading of multiple files.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
When I use CreateIconFromResource to create cursor from rc file(.ani file),some .ani files succeeds,some fails.
the code like this:
HINSTANCE hInst=AfxGetInstanceHandle();
HRSRC hRes=FindResource(hInst,MAKEINTRESOURCE(nID),"ANICURSORS");
DWORD dwSize=SizeofResource(hInst,hRes);
HGLOBAL hGlob=LoadResource(hInst,hRes);
LPBYTE pBytes=(LPBYTE)LockResource(hGlob);
HCURSOR hCursor=(HCURSOR)CreateIconFromResource(pBytes,dwSize,FALSE,0x00030000);
Who can give me some advice,thank you!
当我用CreateIconFromResource函数从资源文件中提取ani文件来创建cursor时,有的ani文件能成功,有的会失败,GetLassErr返回为0,什么原因,该怎么解决,谢谢!
|
|
|
|
|
What is the error code? Check the error code by calling GetLastError() or by adding @err,hr to the watch window.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
Hi,
There is no any problem in the code..
Its working for me.
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
I am connecting Sqlserver2000 with VC++6.0(MFC) and ERROR when update information. please help me. thanks very much
----------------------------------------------------
void CReadDBDlg::OnRead()
{
// TODO: Add your control notification handler code here
CDatabase database;
CString SqlString;
CString sCatID, sCategory;
CString sDriver = "SQL Server";
CString sDsn;
CString sFile = "nhanvien_DATA.mdf";
int iRec = 0;
sDsn.Format("Driver={SQL Server};Server={EZITWK115};" "Trusted_Connection=no;""Database=NHANVIEN;Uid=sa;Pwd=sa;");
TRY
{
// Open the database
database.Open(NULL,FALSE,FALSE,sDsn,TRUE);
// Allocate the recordset
CRecordset recset( &database );
CString SS2 = "UPDATE nhan_vien SET hoten = 'nU' WHERE manv = '002' ";
//Execute query ====>> This is ERROR !!!
recset.Open(CRecordset::forwardOnly,
"{CALL " + SS2 + "}", CRecordset::executeDirect);
// Close the database
database.Close();
}
CATCH(CDBException, e)
{
// If a database exception occured, show error msg
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
}
-------------
|
|
|
|
|
phan xuan nguyen wrote: //Execute query ====>> This is ERROR !!!
WHAT error?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I need to send and receive data from mutiple comports may be around 10,
parallely.
Now I am able to work with single comport.
What are the things to be taken care for mutiple port
communication.
Can I have single receiving thread for all ports,
or I must have separate receiving thread for all ports.
Please clarify.
If any document is there, please give me link.
Regards,
Sunil Kumar
|
|
|
|
|
You are reposting the same question.
Previous question link[^]
Your doubt was answered by Cedric
If you have not checked it please check.
Regards,
Sandip.
|
|
|
|
|
hi.
how can i create an application that listens to the desktop events.
for example , poping up a messege whenever i click the ctrl btn.
thanks.
|
|
|
|
|
Do you mean that you want to hook/"listen to" all messages that are posted to windows in the current desktop?
Haimbert wrote: for example , poping up a messege whenever i click the ctrl btn.
You can create system-wide hotkeys using the RegisterHotKey() function (documentation here).
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
what im basicly trying to do is to create a process that listens to the keyboard events in all windows, and if a user clicks on the "ctrl" button , a square will be painted arround the mouse cursor.
im doing it in mfc. and i dont even know if i have to create a CFrameWnd object. i dont want to create a window , only listen to key events in the computer.
|
|
|
|
|
You'll want to use the SetWindowsHookEx() with the WH_KEYBOARD or WH_KEYBOARD_LL hook procedure - see the documentation here.
This article should also help get you started
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|