|
Image list does it automatically, I think. Just get that icon with all the resolutions it has and then add it to your image list. It will pick a necessary resolution (i.e. the one you set) and add a single-resolution version of that icon.
|
|
|
|
|
Hi!
I'm having a problem with printing a special char in an RichEdit box by code.
My App was compiled with UNICODE & _UNICODE and I set the RichEdit to the right font.
While the App is running I can enter the character (square root) into the RichEdit by pressing Alt + 8730, but when I try print it with code
WCHAR ch[2] = {L'\x221A',NULL};
m_ctrlInput.SetWindowText(ch);
there is just a 'v' appearing.
When I set the ch[0] to any ascii code (< 256) it works fine, but it won't do it with Unicode characters.
Any suggestions?
|
|
|
|
|
Iam trying to convert a time count which is in milliseconds to get Date and Time in VC++,but iam unable to get any function in vc++ that serves my purpose.Is there any function which converts a count to Date and Time.
|
|
|
|
|
I assume you want to include milliseconds in the time display; otherwise this does not make since.
void MyStartTimer()
{
time_t t1, t2;
t1 = t2 = time(NULL);
while( t1 == t2 )
t2 = time(NULL);
m_timeStart = t2;
}
BOOL MyGetDateTime(struct tm* ptm, unsigned* pMilliseconds)
{
time_t timeEnd = time(NULL);
time_t seconds = m_dwTimeCount / 1000L;
*pMilliseconds = m_dwTimeCount - (seconds * 1000L);
struct tm* ptmLocal = localtime(&timeEnd);
if( ptmLocal )
{
memcpy(ptm, ptmLocal, sizeof(struct tm));
return TRUE;
}
return FALSE;
}
Oh well, something like that should work. The actual formating is up to you.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I have just run This Code from MSDN ,and see What M$ compiler generted for me
CODE
#include <list>
#include <iostream>
using namespace std ;
typedef list<int> LISTINT;
void main()
{
int rgTest1[] = {5,6,7};
int rgTest2[] = {10,11,12};
LISTINT listInt;
LISTINT::iterator i;
listInt.insert (listInt.begin(), 2);
listInt.insert (listInt.begin(), 1);
listInt.insert (listInt.end(), 3);
for (i = listInt.begin(); i != listInt.end(); ++i)
cout << *i << " ";
cout << endl;
}
Warnings
--------------------Configuration: 1 - Win32 Debug
Compiling...
4.cpp
D:\Alok\Working\TestProject\TEst\4.cpp(24) : see reference to function template instantiation 'class
std::basic_ostream<char,struct std::char_traits<char> >
&__cdecl std::operator <<(class td::basic_ostream<char,
struct std::char_traits <char> > &,const char *)' being
compiled
c:\program files\microsoft visual studio\vc98\include\ostream(305) : warning C4018: '!=' :
signed/unsigned mismatch
D:\Alok\Working\TestProject\TEst\4.cpp(24) :
see reference to function template instantiation 'class
std::basic_ostream<char,struct std::char_traits<char> >
&__cdecl std::operator <<(class std::basic_ostream<char,
struct std::char_traits<char> > &,const char *)' being
compiled
c:\program files\microsoft visual studio\vc98
\include\xmemory(37) : warning C4100: '_P' : unreferenced
formal parameter
c:\program files\microsoft visual studio\vc98\include
\xmemory(68) : see reference to function template
instantiation 'void __cdecl std::_Destroy(int *)' being
compiled
c:\program files\microsoft visual studio\vc98\include\
xlocnum(430) : warning C4100: '_Lobj' : unreferenced formal
parameter
c:\program files\microsoft visual studio\vc98
\include\xlocnum(431): while compiling class-template
member function 'void__thiscall std::num_put<char,class
std::ostreambuf_iterator<char,struct std::char_traits<char>
> >::_Init(const class std::_Locinfo &)'
Linking...
1.exe - 0 error(s), 17 warning(s)
Could any body suggest me the way to solve that.
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
br/> visit me at http://www.thisisalok.tk
|
|
|
|
|
|
Yeah sir,
Service Pack 5 hs been installed on my computer.
thanks
|
|
|
|
|
I want to access explorer toolbar.for example i want to hide the menu bar on the explorer that appears when i open drive C. Can anybody help me how to do that in visual C++ 6. The problem is that i can get handle to menu of any window that is active on desktop just by getting handle to window.but how to get handle to toolbar of active window because as far as i think the menu of explore is not just menubar as in dialog based application but it is menu bar over a toolbar.
|
|
|
|
|
On a dialog application I would like to capture keyboard input when I press a button and then stop when the button is pressed again.
I have included the WM_CHAR and WM_KEYDOWN messages on the dialog, but they are not activated.
I can type into an Edit box on just press keys when over the dialog, but breakpoint in
void CKeyBoard_CDNUDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) is never reached.
Is there something else I need to do in order to get the keyboard characters pressed.
|
|
|
|
|
You need to do it in PreTranslateMessage.
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if (pMsg->message == WM_KEYDOWN)<br />
{<br />
if (pMsg->wParam == some_key_code)<br />
{<br />
Do_SomeThing();<br />
}<br />
}<br />
<br />
return CDialog::PreTranslateMessage(pMsg);<br />
}
|
|
|
|
|
Thanks now doing it in PreTranslateMessage, but all the normal keys I process seem to be upper case, even when I change the Caps Lock.
ARe they a flag that controls the case?
sweep123
|
|
|
|
|
how can i work with htmlhelp in visual studio .net (visual C++)?
i want use ::HtmlHelp() but when i compile i get the error:
Fatture error LNK2001: unresolved external symbol "struct HWND__ * __stdcall HtmlHelpA(struct HWND__ *,char const *,unsigned int,unsigned long)" (?HtmlHelpA@@$$J216YGPAUHWND__@@PAU1@PBDIK@Z)
somebody can help me please?
thanks a lot
|
|
|
|
|
Make sure you link to htmlhelp.lib. By default it is located in C:\Program Files\HTML Help Workshop\Lib
|
|
|
|
|
where i set the link to the library htmlhelp.lib?
thanks and merry christmas
|
|
|
|
|
Go to project properties to Linker section. Also look for C++ FAQ on this site... IIRC it has info about that plus more stuff you probably want to learn.
|
|
|
|
|
I want to access Window Procedure of another processes window. I just want to display address of that window procedure.
In short Something like SPY++.
To add to above, GetWindowLong fails for GWL_WNDPROC (but works for GWL_HWNDPARENT) and GetLastError returns 0.
Does this fail because the target window lies in different process?
If yes, then how does SPY++ do same thing
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I am developping in VC 6 and my app. do not run over XP.
Could somebody help me?..
|
|
|
|
|
What's the problem you are facing.
Still Alone in this beautiful world
My Articles
|
|
|
|
|
The project run with win 98. In Xp simply, the app. do not start. I haven't any error, only do not run.
I thought that the problem is the plataform, isn't it?
Something special to install?
|
|
|
|
|
Hmmm. Is it a debug build? If so, build a release version and try that - it doesn't need the non-distributable DEBUG dlls for CRT and MFC.
You should check the dependencies (using DEPENDS.EXE) to see that the DLLs it needs are on your XP platform. Do you get any diagnostic messages at all?
Steve S
Developer for hire hired!
|
|
|
|
|
Thank you, I have solvered my problem, just was my CRY.Rpt Control... Thank again....
|
|
|
|
|
Friends,
I am opening a file using std::fstream . The purpose is to read all the contents of file into a buffer and then close the file. Program uses this buffer later.
The problem is that i am not an expert of fstream . I am using a function Read() , to copy data from file to buffer. The problem is the allocation of buffer. Lets see what i am doing:
fstream file("somefile.txt");
char *pBuffer = CreateNewBuffer(100) // 100 is buffer size
while(!file.eof())
{
file.read(buffer,100);
// Blah Blah
}
I don't know the number of bytes actually present in the file and so i am creating the buffer of size 100.
Is there any way to find out that how many bytes are there in the file OR how many bytes left, so that there will only be one Read() call instead of loop??
And most important for me is that how may bytes are actually read into the buffer.
Imtiaz
|
|
|
|
|
std::ifstream isn't designed to allow the reading of the entire filesize. The function _filelength in <io.h> will give you the length of a file. Be warned that this function is limited to the size of a long, so for very large files you'll need to use a platform dependant API (See MSDN).
The following function taken from the boost::regex sample code (regex_grep_example1.cpp) is one example of how to efficiently and safely allocate space using std::string. This is not the simplest solution, it is flexible. However without profiling this is micro-optimisation that probably isn't going to help. Note the use of reserve and capacity to ensure appropriate growth system for you buffers. You may be able to tweak initial size and growth rates if you know roughly what size the file will be.
void load_file(std::string& s, std::istream& is)
{
s.erase();
if(is.bad()) return;
s.reserve(is.rdbuf()->in_avail());
char c;
while(is.get(c))
{
if(s.capacity() == s.size())
s.reserve(s.capacity() * 3);
s.append(1, c);
}
}
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
hi all,
I have added Edit Box to MFC Dialog base Program.I also activated auto Horizontal Scroll Bar and Vertical Scroll bar..
How do I show a Message (say "hellow") when click on a Scroll bar of that edit box.?
If any know that please reply me...
Thanks in advance..
|
|
|
|
|
Add Message Handlers for EN_HSCROLL and EN_VSCROLL messages and display MessageBox there.
Now, I hope you know how to add message handlers. If you dont, u can find it in any basic level MFC Book.
Regards,
Still Alone in this beautiful world
My Articles
|
|
|
|