|
Any advice as to which is a good way to add CD data burning capabilities to an app ? Anyone here have any experiences with an SDK or Control?
I think if I could stick to XP that I could use the Image Mastering API, unfortunately not all users have XP yet.
Regardz
Colin J Davies
* WARNING * Save your work This link is to reboot your PC
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|
|
I've heard people say that there's a free Nero SDK that's a good one to use, but I've never done CD burning myself, so I don't know.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
The SDK is free, but you need Nero installed for it to work...
-
|
|
|
|
|
I'm trying to grab text that is already in a multi-line edit control, append more text to it and then reset the edit control to the new text. Unfortunately I'm getting memory errors after one or two times of performing this process.
Here is the code I'm using:
int cTxtLen = GetWindowTextLength(hwndEdit);
pszMem = (LPTSTR) GlobalAlloc(GPTR, cTxtLen + 1);
GetWindowText(hwndEdit,(LPWSTR)pszMem,cTxtLen + 1);
List = pszMem;
GlobalFree(pszMem);
// run List through a function that appends more text
SendMessage (hwndEdit, WM_SETTEXT, 0, (LPARAM) List.GetBuffer(0)) ;
List.ReleaseBuffer();
Anyone see what might be causing these errors?
Thanks,
stf
|
|
|
|
|
Not good code. You aren't checking any return values. You are using old 16bit Global memory functions. You haven't said what the errors are, which makes helping quite difficult. Have you ruled out "function that appends more text" isn't the culprit.
What is wrong with:
GetWindowText( &List ) assuming you have a CWnd or
CWnd::FromHandle( hwndEdit )->GetWindowText( &List ) if you don't.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Also note:
cTxtLen + 1
should be
cTxtLen + sizeof(TCHAR)
Trust in the code Luke. Yea right!
|
|
|
|
|
If my memory serves me right then you should always use ::GlobalLock on the handle returned by ::GlobalAlloc and use the pointer returned by ::GlobalLock instead. Also, you are casting your pointer to LPWSTR - are you compiling with UNICODE enabled? If so, you should be allocating cTxtLen * sizeof ( WCHAR ) instead of just cTxtLen. If not, you should just cast to LPTSTR. Anyway, multiplying by sizeof( TCHAR ) when allocating is always a good idea to be Unicode compliant.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Thanks a lot for the help everyone. Here is what I've got now:
int cTxtLen = GetWindowTextLength(hwndEdit);
if(cTxtLen > 0)
{
pszMem = (LPTSTR) GlobalAlloc(GPTR, cTxtLen * sizeof(WCHAR));
if (pszMem == NULL )
OkMessage (hwnd, TEXT ("Alloc failed!!!"), TEXT ("\0")) ;
pszMem = (LPTSTR)GlobalLock(pszMem);
if (pszMem == NULL )
OkMessage (hwnd, TEXT ("GlobalLock failed!!!"), TEXT ("\0")) ;
GetWindowText(hwndEdit,(LPWSTR)pszMem,cTxtLen + 1);
List = pszMem;
GlobalUnlock(pszMem);
pszMem = (LPTSTR) GlobalFree(pszMem);
if(pszMem != NULL)
OkMessage (hwnd, TEXT ("GlobalFree failed!!!"), TEXT ("\0")) ;
SendMessage (hwndEdit, WM_SETTEXT, 0, (LPARAM) List.GetBuffer(0)) ;
List.ReleaseBuffer();
}
Neville Franks: I have already ruled out the function that is appending the text as not being a problem. I'm getting errors like:
The instruction at "0x77f5215e" referenced memory at "0x00000004". The memory could not be "written".
Click on OK to terminate the program
Unhandled exception at 0x77f536f7 in list.exe: 0xC0000005: Access violation writing location 0x003a0043.
Also I'm not that familiar with MFC at the moment which is why I'm trying to stick with just the API functions.
This code does fine for 5 times through but on the sixth time I get an error like the ones listed above. Both seem to be dealing with "writing" the memory, I'm not sure if it makes a difference or not but the variable "List" is of CString type. Also, could it be overflowing the edit control?
Thanks for the help,
stf
|
|
|
|
|
Hi all,
Is there any way to enum all DCs in a domain, using ADSI or DS API on a win2000 box ???I have already done this sometime ago using NetServerEnum (NETAPI).
I´ve found DsGetDcOpen/DsGetDcNext but they require Windows XP or later...
I´ve tried the "Role Property" for IADSComputer Class, but the WinNT and LDAP providers doesn´t suport it...
Thanks in advance
|
|
|
|
|
I have a combo on a toolbar. i'm trying to capture CBN_DROPDOWN via ON_CONTROL_REFLECT, but it looks like the WM_COMMAND messages are getting lost somewhere. i know the CComboBox class works (captures the msg) if i put one on a normal modal dialog. but, when it's on the toolbar, that message never shows up - i'm assuming the toolbar eats it.
so... does anyone knof if there's a trick to making the CComboBox/CToolBar combo play nicely ?
here's how i create the combo:
m_toolbar.m_combo.Create(WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL|CBS_DROPDOWNLIST|CBS_HASSTRINGS,
rect, &m_toolbar, IDC_DE_TB_COMBO));
here's the CComboBOx's message map stuff:
BEGIN_MESSAGE_MAP(CItemDataCombo, CComboBox)
ON_CONTROL_REFLECT(CBN_DROPDOWN, OnDropdown)
END_MESSAGE_MAP()
ideas?
-c
|
|
|
|
|
I just tried this with a combobox on a toolbar in one of my programs, and the CBN_DROPDOWN handler in the combobox was called properly. My toolbar is a custom toolbar class derived from a derivative of CToolBar, but I don't really have anything fancy setup.
Here's my creation code (in a member of the toolbar class):
if( !c_oCompression.Create( WS_CHILD|WS_TABSTOP|CBS_DROPDOWNLIST, CRect( 0, 0, 0, 0 ), this, ID_COMPRESSION_COMBO ) )
For the test, I just quickly added a derived combobox class to my project, and swapped out the default combobox class with the new class. Then I wired up the ON_CONTROL_REFLECT and it works perfect.
So, I'm not sure what it is, but there must be some difference between the way my program sets it up and the way yours does.
Chris Richardson Terrain Software
|
|
|
|
|
try this way
Chris Losinger wrote:
BEGIN_MESSAGE_MAP(CItemDataCombo, CComboBox) //{{AFX_MSG_MAP(CItemDataCombo) ON_CBN_DROPDOWN(IDC_COMBO, OnDropDown)
//}}AFX_MSG_MAPEND_MESSAGE_MAP()
|
|
|
|
|
How can I start a VPN connection programatically? Also creating the VPN connection is of concern too. What set of APIs will be useful RAS or TAPI? Are there any articles or tutorials on doing this sort of thing?
|
|
|
|
|
|
Maybe RasDial is what the guy was looking for, but by VPN one usually refers to the secure stuff on top of raw dialup connections as provided by the OS.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
Maybe RasDial is what the guy was looking for, but by VPN one usually refers to the secure stuff on top of raw dialup connections as provided by the OS.
As I understood he wants to use the VPN provided by Windows 2000, not a router/firewall specific one.
As such, this kind of VPN appears as a "virtual" DUN for RAS. And to connect, you use RasDial.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
We have alot of data we need to store. Sometimes on the order
of 3000 elements . Thus, I could declare a large square matrix
(ie: 3000 by 3000) entries for a double data type . This is,
obviously, totally undesirable. On a P4 it takes about 1/2 a minute
to initialize just the array, nevermind the calculation .
Furthermore, because we have a diagonal matrix (mirror symmetry
about the matrix diagonal) the lower half of the matrix is
redundant. Thus, we decided (for now) to go with a stair-case
type matrix. ie:
<br />
m_ppdDeltaMMatrix = new double*[m_uzMaxNodes];<br />
<br />
for (int i = 0; i < m_uzMaxNodes; i++)<br />
m_ppdDeltaMMatrix[i] = new double[i+1];<br />
For large matrix sizes (thousands) the memory savings converge
to approximately 50% or (n-1)/2 . The data is also sparse (quite a
few zeroes). I was wondering if anyone had a novel way of solving
this problem (I don't ). This would imply reducing the number of entries to
only those necessary, while being able to address arbitrary elements
of the matrix like: m_ppdDeltaMMatrix[3][2] or
m_ppdDeltaMMatrix[300][127] in the next access to the data.
Any help would be greatly appreciated.
|
|
|
|
|
One solution is a map.
Kuphryn
|
|
|
|
|
First question, before you go down and dirty: do you really need the huge matrix? is there another algorithm yielding similar results? (peterchens #1 rule in optimizaton: can you avoid it?)
Some 7 years ago I looked at some RogueWave libraries for matrix manipulaiton, they claimed to have effective and fast sparse matrices. (Rule #2 - can you use the implementaiton of someone else?)
Depends on the required lookup speed, required lookup methods, and if there's some rule in the sparseness.
For high sparseness, acceptable memory consumption and fairly fast lookup, you can use a map<int index,double value> for each row (or column, if this yields better results). Add to the map only the indices that are actually used, and provide an overloaded operator[], that looks uses map.find to see if the element is actually there, and return 0.0, or *find
This is deadly, however, if you want ot use a "normal" matrix multiplication for multiplying two of these.
Two other options (that are simple to implement only if index access can be slow, but iteration through a row must be fast): store which cells are occupied separate from the cell data itself. e.g. an int (or even byte) array: alternating one value number of zeroes, number of "used" values, then store the double's packed, e.g. a
( 0 0 0 1 0 0 2 3 4 0 0 0 ) matrix would be encoded
( 3,1,2,3,3 ) (1,2,3,4)
Index access is very slow here.
Or use a bit mask to identify occupied cells. (good compression of zeroes, fast iteration, but for index access you need some extra data and clever lookup table juggling.
If you need multiplication often, you can create a row-iterable and a column-iterable matrix, and use a specialized multiplication can very quickly identify where there are non-nulls "meeting" each other.
Well, there are more clever layots (I can *feel* it ) - but maybe you just say what you have to *do* with the matrix.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Ok, now we're talking. This is just the type of reply
that I was hoping for. Now a bit more on the nature of
the problem.
Problem 1: Huge matrices are UNAVOIDABLE.
Problem 2: Noone has ever tackled this particular
problem before (either in literature or
in another commercial product.)
Problem 3: Just coming up with a method of solution for
this problem required a solid week of
brain-wracking work by a trained physicist (me!)
and a mathematician.
Problem 4: I am not a programmer, and so am looking for a
better implementation for a data structure
One positive is that we don't ever (I repeat never) need
to multiply any of these matrices together. They are solely
used as "lookup tables" if you will. Each entry in the matrix
is addressed by (row,column) and this is important. Let's say
for now that each entry represents a connection between nodes
and the entry at that location is significant. For example:
entry (0, 2) represents a connection between city 0 and city 2 and the data stored at (0,2) would be, say, the distance between city 0 and city 2 (in double form). If you can imagine 7 cities with possible interconnections between all 7 cities (ie: (0, 1), (1, 7), (3, 4), (4, 3, etc...) where (3, 4) = (4,3) But ah! What redundancy through yonder window breaks!) you will see that connections may or may not exist, thus, there is no 'rule' per se on the sparseness of the matrix. Furthermore, entries can generally be made in any conceivable order (for 7 cities, that is quite a few permutations) However, the buck doesn't stop there! We're talking *thousands* of possible interlinks. (The data isn't cities and distances, but that is irrelevant - the behaviour is the same). Also, any given entry at some point may be removed. Speed *is*, unfortunately a great concern as the code is quite optimized right now.
I think the map idea is becoming attractive. Others I work with have proposed use of a linked list or STL vector, but I am a bit discouraged by those ideas - they make searching the table a bit daunting.
One question I do have concerns the maps. If each entry is indexed by 2 nodes (as above) how would a map of the form
map<int index, double value> help here? Is this not basically an STL vector style implementation?
Thanks for the help.
|
|
|
|
|
John Theal wrote:
One question I do have concerns the maps. If each entry is indexed by 2 nodes (as above) how would a map of the form
map<int index,="" double="" value=""> help here? Is this not basically an STL vector style implementation?
// 0 <= row < numberOfRows
// 0 <= col < numberOfCols
int mapIndex = row*numberOfColumns + col;
// row = mapIndex/numberOfCols
// col = mapIndex%numberOfCols
|
|
|
|
|
One solution is to use a Map for each row.
Another solution is a map < pair<int,int> xy, double distance >
However, I would use the latter only if it's *really* sparse. You could run performance checks against both, but I'd expect the one-map-per-row to be faster still.
OK, breakdown of my previous post (I guess it might have got lost): random index access is fastest with map, row/colum iteration can benefit from another storage scheme.
so you emulate the matrix by a vector < map<int, double=""> * >, and can keep unused rows as NULL pointer.
lookup is them basically:
double GetItem(int row, int col)
{
if (below diag)
return GetItem(above diag);
map<int,double> * rowMap = m_vector[row];
if (rowMap == NULL)
return 0.0;
map<int,double>::iterator it = rowMap->find(col);
if (it == rowMap.end())
return 0.0;
return it->second;
}
I'm still pondering a thought of a "better" storage scheme, however, the map will take you quite far. You can probably boost performance (if required) by a custom pool allocator.
May I asked what you're working on? I've got 5 years of successless physics study in my backlog...
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
We're trying to simulate real-time surface deformation
with possible extension to a collision detection algorithm.
Speed and low memory consumption are therefore very
desirable.
|
|
|
|
|
|
Slow at the moment - we're bug slaying. Our solution
engine is also cranking out correct solutions, but they
are sometimes translated and/or rotated (albiet correct...) .
I therefore haven't had time to code/implement the array
map yet. Soon though...
Let's just say we still have some work to do.
I think it will eventually be a go.
|
|
|
|
|