|
I have a button on a list, something like whenever you select a row, move the button to that row. So I implement this in OnLvnItemchangedList event:
void CMyDlg::OnLvnItemchangedList(NMHDR *pNMHDR, LRESULT *pResult)
{
...
CRect rec;
...
m_myBtn.MoveWindow(rec);
m_myBtn.ShowWindow(SW_SHOW);
m_myBtn.BringWindowToTop();
InvalidateRect(rec);
m_myBtn.RedrawWindow();
}
It works, but I cannot see the button.
If the mouse moves over the button, it shows then I can see it.
I don't know why, maybe there's something wrong in my last two source code rows. Can anyone explain how to solve this??
Thank you in advance !!
|
|
|
|
|
Check the coordinates of the button and you will see why you dont see it
Greetings from Germany
|
|
|
|
|
hi KarstendK,
I don't understand what you mean. When I move the mouse over the button, it shows.
|
|
|
|
|
i downloaded a source code named mpeg2dec, but when i began to compile it i got such an error.
I am not sure why it occurred. The original project is a vc6 project. I use vc2005. So, who recognize this error and how to resolve it?
The original error is:
1>c:\program files\microsoft visual studio 8\vc\include\stdlib.h(592) : error C2485: '__restrict' : unrecognized extended attribute
Does it because VC2005 not support __restrict keyword?
Thanks
modified on Friday, July 25, 2008 2:01 AM
|
|
|
|
|
I would expect it to be the other way around, VS2005 to recognize __restrict and VC6 not to if anything.
Check that your source isn't intended to be compiled with GCC/glibc which makes extensive use of __restrict. As the error is showing in stdlib.h a standard header file I'm guessing something you've included before stdlib.h has messed with the Compiler by doing something like a #define __declspec or a #define restrict. I've only ever seen that sort of thing when someone is attempting to get cross compatibility with GCC. It's just a guess though, could be something else entirely.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
ok. when i delete the line : #define restrict __restrict
all is ok.
thanks
|
|
|
|
|
That would do it
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
Hi all,
I want to overload a function to do a simple processing. Only one argument is used in two cases, std::string variable and std::wstring variable. I want to try out it without overloading.
Took a tour in Google and I feel that there is a way to do using templates. I never work on with those. Can you guys give me a help. I just want to do a simple test. If I'm correct templates is a long section to completed.
Your help really valued to me.
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
template<typename stringtype="">
void foo(StringType str)
{
// Do processing here.
}
string str;
wstring wstr;
foo(str);
foo(wstr);
-Saurabh
|
|
|
|
|
Thanks for the quick replay.
I found that in most of documents templates are define as follows.
template <class t=""></class>
So, what's the different with your answer and this?
By the way, can't I pass values by reference. I tried it and working fine. But give a warning there.
<br />
see reference to function template instantiation 'int <br />
GetString<std::string xmlns:std="#unknown">(T &)' being compiled<br />
<br />
with<br />
[<br />
T=std::string<br />
]<br />
</std::string>
I appreciate your help all the time...
CodingLover
|
|
|
|
|
sorry forgot to include code tags in the post...correct code is
template<typename StringType><br />
void foo(StringType str)<br />
{<br />
}<br />
<br />
string str;<br />
wstring wstr;<br />
<br />
foo(str);<br />
foo(wstr);
you can pass by reference, use this code.
template<typename StringType><br />
void foo(StringType& str)<br />
{<br />
}
-Saurabh
|
|
|
|
|
It's ok, I got it. How about the second part. Pass value by reference?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
this isnt templating but another method
void MagicStringFunc(char* format,...)
{
va_list args;
va_start(args,format);
string MyString;
wstring MyWideStr;
if(*format == '%')
switch(*++format)
{
case 'w':
case 'W':
MyWideStr+= va_arg(args,wstring);
break;
case 's':
case 'S':
MyString+= va_arg(args,string);
break;
}
va_end(args);
}
you get the basic idea so you can send format strings like printf kinda IE "%s"for string or for widestring in this case "%w"
int main()
{
MagicStringFunc("%s","TEST STRING");
MagicStringFunc("%w",L"TEST WIDESTING");
}
it might be overkill for this situation but can be handy if you a dealing with different languages etc where you need to handle a few options with the same function.
it is also easier to build upon this function if you want to handle an unknown number of params and you can even mix the types up sweet as
modified on Friday, July 25, 2008 7:29 AM
|
|
|
|
|
Hi all,
Please anyone can tell me how can i stop enter special cahracters (@,#,$,%,^,&,*,~,!) in Editbox.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
You can perform it in three ways.
One is override PreTranslateMessage.
Another one is to subclass your Editbox.
Also there is another one derive your custom editbox from CEditBox, on WM_CHAR message you can disbale special character.
|
|
|
|
|
Subclass CEdit and override subclass OnPreTranslate(). you can also do it with the EN_CHANGE event in your dialog class but that would require some logic of storing the string, comparing it with the previous one, finding if the new character is the one which you DON'T want etc etc.
Hope it helps.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Can you show any example of this.
Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi,
there is an excellent Codeproject article called CFilterEdit: Use Regular Expressions to filter your input by Ben Hanson. This can serve you well as a base clase for your problem.
http://www.codeproject.com/KB/edit/FilterEdit.aspx[^]
There are already some sample derived classes like
* CCurrencyEdit
* CDateTimeEdit
* CFloatEdit
* CIntEdit
* CUIntEdit
* CUIntRangeEdit
* CSpin
So long,
Stefan
|
|
|
|
|
Hi all;
i m using this on PreTranslateMessage(MSG* pMsg)
if (pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_RETURN))
{
UINT CtrlID = ::GetDlgCtrlID( pMsg->hwnd );
// Check whether its that of your button.
if( CtrlID != IDOK &&
CtrlID != IDCANCEL && )
{
pMsg->wParam = VK_TAB;
}
}
for using both on Tab key and enter key on controls execpt button controls.
Now on presssing Tab key the button is clicked.
I dont want to press button on Tab key.
Please tell me what can i do?
I m waiting for ur valuable suggestions.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
modified on Friday, July 25, 2008 1:17 AM
|
|
|
|
|
The simple solution just remove the tab stop style from button controls.
modified on Friday, July 25, 2008 2:19 AM
|
|
|
|
|
Hi all,
I am making some connections with gsoap and services as I am looking into an example program I notice why this is possibe:
class CMyCurrencyConvertor
{
public:
CMyCurrencyConvertor();
virtual ~CMyCurrencyConvertor();
bool GetConversionRate(CString sFromCurrencyCode,CString sToCurrencyCode, double &dRate);
bool GetConversionRate(ns1__Currency oFromCurrencyCode,ns1__Currency oToCurrencyCode, double &dRate);
Can someone explain to me the double meaning of GetConversionRate()
thanks,
Jayjay
|
|
|
|
|
That is function overloading. Allows you to use functions with the same name that do similar tasks. Based on the parameters of the function the compiler decides [runtime] which version of the function does it give a call to.
For eg: if you have to add two numbers irrespective of the parameters to the Add function you can simply write:
void Add(int a, int b);
void Add(float a, float b);
it would really be a bit cryptic if you want to add two numbers and have to write functions as
void AddInt(int a, int b);
void AddFloat(float a, float b);
you would need hundreds of names in case you want to add different types of variables and write functions for them.
In essence function with the same name do similar tasks. In your case they give you the Conversion Rate with different parameter types
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
modified on Friday, July 25, 2008 1:03 AM
|
|
|
|
|
I need some quick help with this problem:
I've created a simple video player using DirectShow.
When I set playing a video file (f.e. wmv) I need do some file decryption (file is encrypted with own algorithm) before playing the movie stream - during reading data from file into DirectShow's stream buffer.
I need some ideas, how can I do this:
> Open video file > fread(buffer, bufflen) / apply buffer decryption -> redirect to DirectShow (apply filters, etc.) -> Play
Thank you for any support
|
|
|
|
|
For DirectShow, you'll probably need to write your own transform filter that
decrypts the raw file data and passes it downstream unencrypted.
Writing DirectShow Filters[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanx, I've done it during today, but created a Source filter (file reader). The transform filter won't work as well
|
|
|
|