|
Use CWindowImpl::SubclassWindow. It is actually derived from CWindowImplBaseT.
|
|
|
|
|
I have developed an ActiveX control that I want to use on a web site. The general idea is that it won't be accessible from the main page, but rather from a popup window that can be opened from any of the pages on the site. I can open the popup, and the control works just fine. However, when I close the popup, and then close the original (parent) window, I get an exception.
From what I gather in my search on the Internet, an ActiveX control does not get (fully?) unloaded when closing the popup. It only gets unloaded when the first browser windows is closed. However, when closing this first browser window, the exception occurs since the ActiveX control has already been sort of "closed".
The exception occurs on an attempt at closing a socket, but the socket can't be found in the CAsyncSocket classes' socket handle map. Weird.
Some further information... I have nine classes (controls) in the ActiveX DLL. I am calling only one of them - the others are just support controls.
I'm not clear at all on what's going on. Has anybody ever experienced something like this before? I would greatly appreciate any ideas since I'm absolutely stuck at this point.
|
|
|
|
|
in following code:
CString s(_T("hello"));
std::wstringstream oss;
CSimpleStringT<wchar_t> ss = s;
oss << (CSimpleStringT<wchar_t>::PCXSTR) ss; //1
oss << ss; //2
both (1) and (2) use CSimpleString<T>::operator PCXSTR()
however,
(1) uses wstringstream::operator<< for const wchar_t *
(2) uses wstringstream::operator<< for const void *
Why?
Compiled on MSVC2005 with enabled unicode support
|
|
|
|
|
Hi,
I have created an ATL exe server which contains one interface. That interface contains one method. I passed an array of short from client side and is printing value of that array in server side. First value of array is correct but other values are worng. I find myself unable to get the reason.
Please Help.
Server Side
-----------
[
object,
uuid(40290173-0658-4414-9379-106D912396C2),
dual,
helpstring("IExeServer1 Interface"),
pointer_default(unique)
]
interface IExeServer1 : IDispatch
{
[id(1), helpstring("method Display")]HRESULT Display([in]short nCount, [in, size_is(nCount)] short *pnValue);
};
Server side Implementation
--------------------------
STDMETHODIMP CExeServer1::Display(short nCount, short *pnValue)
{
char szBuffer[20] = {0};
short int nCounter;
for(nCounter = 0; nCounter < nCount; nCounter++)
{
sprintf(szBuffer, "%d", pnValue[nCounter]);
MessageBox(NULL, szBuffer, "Message", MB_OK);
}
return(S_OK);
}
Client Side Implementation
--------------------------
HRESULT hResult;
IExeServer1 *pIExeServer = NULL;
int iCounter = 0;
short *pnValue = NULL;
::CoInitialize(NULL);
hResult = CoCreateInstance(CLSID_ExeServer1, NULL, CLSCTX_LOCAL_SERVER, __uuidof(IExeServer1), reinterpret_cast<void **="">(&pIExeServer));
if(SUCCEEDED(hResult))
{
pnValue = reinterpret_cast<short *="">(CoTaskMemAlloc(5 * sizeof(short)));
for(iCounter = 0; iCounter < 5; iCounter++)
{
pnValue[iCounter] = iCounter + 1;
}
pIExeServer->Display(5, pnValue);
CoTaskMemFree(pnValue);
pIExeServer->Release();
}
::CoUninitialize();
Thanks
Manish Rastogi
|
|
|
|
|
Hi AJAX xperts,
I have AJAX autocomplete Textbox, which is a user control. i am getting employee details into this text box. upon typing 3 chars it will fetch 20 records which matchs with the prefix text.
I modified _highligted function(item) in Autocomplete.js in order to store emp fullname in window.status .
upon mouse over on this list i need populate employee details like dept, empid, empmanager, empcost center
here is my autocomplese.asmx C# code :
public string[] GetCompletionList(string prefixText, int count)
{
if (count == 0)
{
count = 10;
}
string peopledata = ConnectionStrings.GetConnectionString("Peopledata");
using (SqlConnection ConnStr = new SqlConnection(peopledata))
{
ConnStr.Open();
SqlCommand sqlcmd = new SqlCommand("GetPeopleDetails", ConnStr);
sqlcmd.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value = prefixText + "%";
sqlcmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(sqlcmd);
DataTable dt = new DataTable();
da.Fill(dt);
DataSet ds = new DataSet();
da.Fill(ds);
string[] items = new string[dt.Rows.Count];
int i = 0;
List<string> PeopleData = new List<string>();
foreach (DataRow dr in dt.Rows)
{
items.SetValue(dr["EmpFullName_MngrName"].ToString(), i);
PeopleData.Add(dr["NBKid"].ToString());
PeopleData.Add(dr["PersonNo"].ToString());
PeopleData.Add(dr["CostCenter"].ToString());
PeopleData.Add(dr["Hierarchy"].ToString());
i++;
}
//return PeopleData.ToArray();
return items;
}//end of sqlconnection
} //end of GetCompletionList
here is my java script code:
var obj;
function GetDataViaAJAX()
{
try
{
obj = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
obj = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e1)
{
obj = null;
}
}
if(obj!=null)
{
obj.onreadystatechange = ProcessResponse;
obj.open("POST", "http://localhost/Autocomplete.asmx/GetEmployeeDetails");
obj.setRequestHeader("Host","localhost");
obj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
obj.setRequestHeader("Content-Length","12");
obj.send("Name=" + document.getElementById("lblNamevalue").value);
}
return false;
}
function ProcessResponse()
{
if(obj.readyState == 4)
{
if(obj.status == 200)
{
var dsRoot=obj.responseXML.documentElement;
var ddlOrders = document.getElementById("ListBox1");
for (var count = ddlOrders.options.length-1; count >-1; count--)
{
ddlOrders.options[count] = null;
}
var orders = dsRoot.getElementsByTagName('orderid');
var text;
var listItem;
for (var count = 0; count < orders.length; count++)
{
text = (orders[count].textContent || orders[count].innerText || orders[count].text);
listItem = new Option(text, text, false, false);
ddlOrders.options[ddlOrders.length] = listItem;
}
}
else
{
alert("Error retrieving data!" + obj.status);
}
}
}
function SetValue()
{
var selectedvalue=document.getElementById("ListBox1").value;
document.getElementById("Hidden1").value=selectedvalue;
return true;
}
Can anyone help me on this plzzzz.......Is it possible to work this functionality with Autocomplete
regards,
Menon
|
|
|
|
|
I have a COM dll written using ATL. There is a interface named
"IVehicle". I want to derive 2 new interfaces from this, named
"IToyota" and "IHonda". How can i do that?
The purpose of doing this is that i should be able to use functions
inside both Base interface(IVehicle) from the drived new interfaces.
Thanks in advance.
|
|
|
|
|
[
uuid(XXXXXXXXXXXXXXXXXXXXXXXXXX),
helpstring("IToyota Interface")
]
interface iToyota : IVehicle
{};
Manish Rastogi
|
|
|
|
|
Hi,
What is the Difference between “vector” and “array”?
when to use which one?
Thanks
Nandu.
|
|
|
|
|
There is no "array" in STL. Do you mean Boost Array?
|
|
|
|
|
I wonder if he means the difference between vector and raw arrays?
Kevin
|
|
|
|
|
I mean usind an simple C++ array and STL vector
|
|
|
|
|
Here[^] is a pretty long discussion about that.
|
|
|
|
|
|
hi,
in the code below, i highlighted my points of interest. the declaration of the template function make takes a const char[]. in the call to this function, why is < deque<char> > inserted before the actual parameter? i.e. it's not in the signature and the parameter is not a typename but an explicit const array of characters.
thanks!
<br />
#include "stdafx.h"<br />
<br />
#include <iostream><br />
#include <cassert><br />
#include <deque><br />
#include <algorithm>
using namespace std; <br />
template <typename Container><br />
Container make(const char s[])<br />
{<br />
return Container(&s[0], &s[strlen(s)]);<br />
}<br />
<br />
int main()<br />
{<br />
cout << "Demonstrating generic find algorithm with "<br />
<< "a deque." << endl;<br />
deque<char> deque1 = <br />
make< deque<char> >("C++ is a better C");<br />
<br />
deque<char>::iterator<br />
where = find(deque1.begin(), deque1.end(), 'e');<br />
assert (*where == 'e' && *(where + 1) == 't');<br />
cout << " --- Ok." << endl;<br />
return 0;<br />
}<br />
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
This is the template function declaration.
template <typename Container> Container make(const char s[])<br />
And your example translates to:
template < deque<char> Container> Container make(const char s[])<br />
Which actually translates to:
deque<char> make(const char s[])<br />
{<br />
return deque<char>(&s[0], &s[strlen(s)]);<br />
}<br />
"const char s[]" is just a parameter to the function make, which in your case returns an object of type deque<char>.
- S
50 cups of coffee and you know it's on!
Rock the Vote: John Simmons / outlaw programmer for '08.
|
|
|
|
|
thanks but i was asking about the call to the function template. if you noticed the second highlighted line, the call specifies <deque<char>> before the actual const char array parameter. This <deque<char> is not part of the signature after the function name. But somehow, it is needed to determine what type the instance of the template function is.
cheers!
-- modified at 1:18 Tuesday 7th August, 2007
I am a SysAdmin, I battle my own daemons.
|
|
|
|
|
By calling make< deque<char> >, you're telling the compiler which template to use, since it can't "infer" the template type from from the arguments.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
For that particular function, the type of Container isn't indicated by the parameters. IOW, if you wrote:
make("C++ is a better C"); how would the compiler know what type of Container you wanted to make?
|
|
|
|
|
Is this possible? In particular, I just installed copypathext.dll from here: http://www.codeproject.com/shell/copypathext.asp. I'd like to invoke the commands in that dll instead of using the context menu.
|
|
|
|
|
|
That was quick, thanks. The routine I want to run was explained in the article as IContextMenu::InvokeCommand. There was also this: The code consists of an ATL DLL project with a single class, CCopyPathContextMenu. Like all context menus, it implements the IContextMenu. What would be the syntax for the entry point to pass to rundll32?
|
|
|
|
|
Mmmm - that's more tricky, if not just plain impossible with rundll32 . It lets you call a C function from a DLL. However, you're wanting to call a COM method. Which means you need a COM object reference, and I don't know how you'd create a COM object on the command line without just writing your own code (in an executable) to do so.
Sorry
|
|
|
|
|
The following code will generate a random integer, then format this in uppercase hexidecimal, and then copy it to a std:string. Is there a better way of doing formatted output to a std:string ?
std::string sRandomString;<br />
std::ostringstream osRandomString;<br />
int x;<br />
<br />
x = (rand() << 16) | rand();<br />
osRandomString << std::hex << std::uppercase << x;
sRandomString = osRandomString.str();<br />
<br />
Why does it not work correctly when I use std::ostringstream::hex and std::ostringstream::uppercase ?
If I want to create multiple random strings by using a loop, am I right in thinking I just need to place the following line at the end of the loop, so that the next string generated will overwrite the previous string in the stream, instead of being appended to it ?
osRandomString.seekp(0);
Is it necessary to place << endl or << ends after x where the formatting takes place ?
eg. osRandomString << std::hex << std::uppercase << x << endl;
If yes, should I use endl or ends ?
|
|
|
|
|
If you want to use STL strings, you might want to look at Boost.Format[^]. Then you could do something like:
osRandomString = boost::format("%X") % x; It's basically a type-safe and more C++-ish version of printf. And there's so much other good stuff in Boost as well that you're doing yourself a favour by using it (IMO!).
|
|
|
|
|
Dear ATL C++ / graphics people,
I already searched the forums, but found no answer, just questions to
this topic. So I'll try my luck and post my question:
I am searching for an easy way to load a sequence of jpeg files (which
form a video) into memory and play them like a video. I furthermore
want to react on a keypress by drawing a frame into the current jpeg
in the sequence and saving it to disk/memory (maybe to disk not during
play, but after it, since there should not be delays, performance
does matter!). Is there a simple way to do this with the ATL already?
A little navigation functionality would be great (jumping to specific
frames, having a slider, Play/Stop Button etc.)
Did anyone already do something like that? I want to use pure ATL
and no MFC since I have a guideline to use ATL only.
Would be nice if that would be possible and anyone could help.
Best regards,
Peter.
|
|
|
|
|