|
|
Can anyone direct me to an article or book that covers Snippets. It seem like Microsoft had a good idea, but no one wrote down the instructions............Again!
I understand the concept, but not the details. I would also like to know if the snippet is copied and pasted into the IDE or are the snippets linked to as a library at build time?
Thanks,
Barry
|
|
|
|
|
Sorry but what does this have to do with C++?
Veni, vidi, abiit domum
|
|
|
|
|
Because its part of the VC 12 IDE package, which millions use to write C++ with!
I am looking for someone with more experience than I. Isn't that part of the purpose of Code Project?
|
|
|
|
|
|
Have you tried here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
I'm looking forward for buying a mac, I will start game development but what is the best mac for programming in C++?
|
|
|
|
|
|
Best mac for visual C++? ...none really. Visual C++ is pretty much the name of the C++ compiler for Windows, so your question is a bit of a contradiction.
|
|
|
|
|
Hello community,
i call/open a help-file from my program, this works fine,
only one thing i can't resolve:
on the help file, if i select a next tab(on the left side), for example tab to search in help content, and close file.
Any next start of that file is the last selected tab from previous call. And that is my problem: how to call the help file with selected first tab item, this is how i call a help file:
<br />
HWND hwndHelp = ::HtmlHelpW(m_hWnd, csPathToHelpFile, HH_DISPLAY_TOPIC, dwTopic);<br />
Helpfile is opened, the right topic is shown, but the tab who is selected is the last one of the previous call, how to set the selected Tab to first index?
I found this in "HtmlHelp.h": HH_DISPLAY_CONTENT, is this a key to show first tab with topics?
Thanks in advance
bosfan
|
|
|
|
|
Hi,
The code below fails to get any input pins for the filter "Mp3 Decoder DMO".
The class ID for the specific filter is {94297043-BD82-4DFD-B0DE-8177739C6D20} . Specifically, it fails at the very first while condition. I get S_FALSE which means "Did not retrieve as many pins as requested."
Does it play any role that this specific filter is DMO (Direct Media Object) filter ? If this is the case, is there nay other way to get the input pins ?
In my graphedit it connects and works just fine , but under my code it fails. Any recommendations ?
IPin* Graph::GetPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, UCHAR PinCounter) {
BOOL bFound = FALSE;
IEnumPins *pEnum;
IPin *pPin;
HRESULT hr =S_OK;
UCHAR localPinCounter = 0;
hr = pFilter->EnumPins(&pEnum);
if (SUCCEEDED(hr)) {
while(pEnum->Next(1, &pPin, 0) == S_OK) {
PIN_DIRECTION PinDirThis;
pPin->QueryDirection(&PinDirThis);
if (bFound = ( (PinDir == PinDirThis) && (PinCounter == localPinCounter) ) )
break;
pPin->Release();
localPinCounter++;
}
pEnum->Release();
} else {
return 0;
}
Regards,
sdancer75
|
|
|
|
|
hi
hi can u please help me to convert string in Unicode bytes,
I do this like this:
CString Hex(long val)
{
CString Buf=_T("");
Buf.Format(_T("%X"),val);
return Buf;
}
int Asc(const CString &cs)
{
unsigned char ch= cs[0];
return ch;
}
int AscW(const CString &cs)
{
CString g=_T("");
int ch = cs[0];
g.Format(_T("%d"),ch);
return _ttoi(g);
}
CString EncodeUserData_16_bit(CString strUserData)
{
CString EncodeUserData_16_bit;
int I=0;
CString hex_string=_T("");
for( I = 0; I<strUserData.GetLength();I++)
{
hex_string=_T("");
CString c=strUserData.Mid(I + 1-1, 1);
int ch=Asc(c);
CString g=_T("");
g.Format(_T("%d"),ch);
ch=AscW(c);
g.Format(_T("%d"),ch);
hex_string=Hex(AscW(c));
if(hex_string.GetLength()<4)
{
hex_string=PadZero(hex_string,4);
}
EncodeUserData_16_bit=EncodeUserData_16_bit+hex_string;
}
return EncodeUserData_16_bit;
}
its convert the string in Unicode bytes only one problem is that
if I convert "hello" to Unicode its return "00680065006C006C006F" but this result mismatch at the end of process.
if in place of "00680065006C006C006F" the value is "680065006c006c006f00" the process successfully finish.
if u please guide me anyhow of help me to solve this, its so grateful to u.
thanks in advance.
|
|
|
|
|
Try something like ...
CString EncodeUserData_16_bit(CString strUserData)
{
CString strEncoded;
for(int i = 0; i < strUserData.GetLength(); ++i)
{
CString unext;
unsigned int chnext = strUserData[i];
unext.Format(_T("%.4X"), chnext);
strEncoded += unext;
}
return strEncoded;
}
Veni, vidi, abiit domum
|
|
|
|
|
this return same vale as my function...
|
|
|
|
|
Well it works fine for me. Maybe you should explain why you think the result is not correct.
Veni, vidi, abiit domum
|
|
|
|
|
Does anybody know how to program a pic micro in C to detect gradient. I have set up ADC pins and each LDR is detecting light. Just need to set that a specific gradient of light detected by LDR will switch a light on.
|
|
|
|
|
Quote: gradient
Do you mean "range of frequencies" (or "range of wavelengths")?
Programming the PIC is relatively simple, I believe. You have first to:
- Be sure your light detector is sensitive to such frequency range.
- Filter in the light of such frequency range.
Once such conditions are satisfied you'll get a high value on the ADC measure when the 'gradient of light' is detected.
Veni, vidi, vici.
|
|
|
|
|
I am new to programming especially with pics. I am measuring the voltage reading from each LDR. It looks like a capacitor charging/discharging. I have an idea of what I have to do detect min and max values calculating the gradient etc. its just actually putting it in code.
|
|
|
|
|
Senned wrote: I have an idea of what I have to do detect min and max values calculating the gradient etc Please provide an example.
BTW what PIC family are you using?
Veni, vidi, vici.
|
|
|
|
|
for instance if the LDR is measuring 5V when it is dark and decreases to 0V this is in an ideal world. My pic is constantly scanning so I will probably need 3 variables each for min and max, so previous min, current min and main min, previous max, current max and main max. Now it will store a value for the previous value then take a new reading, if the current min is less than the prev. min then it would replace it as the main min. same goes for max if current max is greater than prev max then it would replace it as the main max value. Now that I have these I have values to calculate my gradient and determine whether or not it is detecting light from a certain light source or just background light. I am using pic24F16KL402.
|
|
|
|
|
Since you can write your application using C , it shouldn't be difficult to implement such logic. Or have you troubles in dealing with the ADC?
Veni, vidi, vici.
|
|
|
|
|
Yeah that has proved to be a problem when I tried it. The pic has only 2 buffers and I have usually had to work with more in the past (assign 1 LDR per buffer). Do you have any idea how to assign more than 1 LDR per buffer? I could send you my code if you like
|
|
|
|
|
Quote: Do you have any idea how to assign more than 1 LDR per buffer?
That is not a problem, actually. Just perform the process sequentially on the LDRs e.g.
- Sample and convert LDR1, take the result from
ADC1BUF0 , store it in variable, say ldr1 . - Sample and convert LDR2, take the result from the same buffer
ADC1BUF0 , store it in the variable ldr2 . - ...
Veni, vidi, vici.
|
|
|
|
|
Does anybody know how to program a pic micro to detect gradient. I have set up ADC pins and each LDR is detecting light. Just need to set that a specific gradient of light detected by LDR will switch a light on.
|
|
|
|