|
I have an array of gray scale pixel values ranging from 1-1024. When I display them by creating a bitmap in a Memory DC and then StretchBlt into screen DC, it somehow converts to a color image, where most of the image color is Magenta. I tried to create and set the Palette of screen DC before calling StretchBlt, but doesn't help. Any suggestions?
|
|
|
|
|
It sounds to me like you're spreading 10 bit grayscale data into 24 or 32-bit RGB data. To get this to work, what you need to do is scale your grayscale info to be 0-255, then set each of the RGB bytes in the Memory DC to that same value.
So, for example, if you had a grayscale value of 512, scale that down to 128 (512/1024 == 128/256). Then copy that 128 into the R, G and B bytes of the bitmap you wish to display. My guess is that your values are spreading into the R and B bytes, causing the Magenta hue. To get gray, each R, G and B must be the same value.
Hope this helps.
|
|
|
|
|
I know that DirectShow and Windows Media SDK can both play back almost any type of AVI file, BUT:
I want to play in REVERSE. In other words, while a video is playing, I want to hit a "reverse" button and have it play backwards - just like in some of the video editing packages available out there. The catch is that I'd like to do this on an AVI file containing native DV information (MSDV codec).
Anyone know how to do this?
Thanks
Brian
|
|
|
|
|
i don't really know, but try the IMediaSeeking interface(description from sdk).
Don't try it, just do it!
|
|
|
|
|
thanks, but....
the IMediaSeeking interface can only "seek"... not play in reverse. It can also set the playback rate, but that's it.
I love all these great interfaces that M$ provides, but if you are missing just one important function, you have to re-think your entire approach.
I read someplace that playing uncompressed video in reverse is MUCH easier than playing let's say, MPEG in reverse. In uncompressed video, I can display a single frame without having knowledge of any other frames in the video. This is unlike compressed video (like MPEG), which needs to "figure out" what the next frame will look like based on the previous frame.
So I'm figuring I can write an application that will hold the video frames in memory. I can then "pump" the frame information forwards or backwards into the "display" routine. In this way I can achieve forward or reverse playback.
Looks to me that I won't be using DirectShow to play back my DV avi's.
Can anyone comment on this?
|
|
|
|
|
Hi,
I have a Mdb file on my WebPage http://www32.brinkster.com/atechcom/db/ClientDatabase.mdb
1) If I use strConnect = "URL=http://www32.brinkster.com/atechcom/db/ClientDatabase.mdb" or "provider=MSDAIPP.DSO;data source=http://www32.brinkster.com/atechcom/db/ClientDatabase.mdb" ...
then I am able to connect to it ... but I could not open the table "Answer" in it (display error)
2) If I use the same database but in local computer strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\ClientDatabase.mdb" ... then I can open the table "Answer" in it!
3) If I use strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=http://www32.brinkster.com/atechcom/db/ClientDatabase.mdb" ... then I could not connect to it!
Note: I am able to open (using my MS Access) manually directly http://www32.brinkster.com/atechcom/db/ClientDatabase.mdb without any problem!
Can anyone help to see why I had those problem in 1) & 3)
Many thanks,
Anh Truong
Here are my codes in VC++
<br />
CString strConnect; <br />
<br />
strConnect = "URL=http://www32.brinkster.com/atechcom/db/ClientDatabase.mdb";<br />
<br />
pdbConnect->Open ((bstr_t) strConnect, "", "", adModeUnknown);<br />
<br />
_RecordsetPtr pList;<br />
_bstr_t strSQL;<br />
_variant_t vNull, var;<br />
CString temp;<br />
<br />
vNull.vt = VT_ERROR;<br />
vNull.scode = DISP_E_PARAMNOTFOUND;<br />
<br />
pList.CreateInstance (__uuidof (Recordset));<br />
pList->PutRefActiveConnection (pdbConnect);<br />
<br />
temp.Format ("SELECT * FROM Answer");<br />
strSQL = temp;<br />
<br />
pList->Open (strSQL, vNull, adOpenForwardOnly, adLockOptimistic, adCmdText);<br />
<br />
if (!pList->GetadoEOF())<br />
{<br />
var = pList->GetCollect ("Conf");<br />
m_text = var.bstrVal; <br />
UpdateData (false);<br />
}<br />
pList->Close();<br />
|
|
|
|
|
I can give you an answer for the third case. ADO will not open websites. The jet engine will not open websites. I think that there is a very good reason for it. The file needs to be downloaded before you can work on it, and I don't think OLE DB can do that. In any case, your 2nd choice is the correct way of connection to an Access file.
As for the 1st case, I have never heard of MSDAIPP.DSO, so hopefully somebody else can help you on that.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hi,
Thanks, but we can not use the download/upload (or copy) ... because while we are doing that, the database still update its contents & can not be orverwrite later! We must access it directly to see what are changing!
Regards
|
|
|
|
|
ATC wrote:
We must access it directly to see what are changing!
OLE DB provides access to any data source for which there is an OLE DB provider. These data sources include email
stores, object databases, network directories, and other nonrelational data stores. A website doesn't fall in any of these categories.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
download the file to the temp folder, and everything works well
Don't try it, just do it!
|
|
|
|
|
Hi,
Thanks, but we can not use the download/upload (or copy) ... because while we are doing that, the database still update its contents & can not be orverwrite later! We must access it directly to see what are changing!
Regards
|
|
|
|
|
no way... this kind of database doesn't support your wishes!
better try ms sql or mysql
Don't try it, just do it!
|
|
|
|
|
I just went through this same problem with an app I am developing. The drivers for Access do not allow remote connections. I had to export my Access database and import it into MySQL and the ODBC driver for MySQL allows you to specify a URL for the server and the database name on the server.
I'm going to live forever or die trying!
|
|
|
|
|
I can define an array in my local variables (to a certain function), but I am having trouble defining that array as a global array that I could use in all of my subfunctions.
Here is how I define the variable in my local area (this works)
<br />
void CMyDialog::OnMyFuntion()
{<br />
<br />
double f1, m_div;
double ValuesArray[200];
<br />
ifstream inf; <br />
inf.open("Testdata1tab.txt");
<br />
for (int i=0; i < 199; i++)
{<br />
inf >> f1;
ValuesArray[i] = f1;
<br />
Value = ValuesArray[i]/m_div;
}<br />
<br />
inf.close();<br />
}<br />
}<br />
When I try to define the array in my .h file as a public variable, I get a runtime error. Here is how I try to define the array:
<br />
class CMyDialog : public CDialog<br />
{<br />
public:<br />
CMyDialog(CWnd* pParent = NULL);
enum { IDD = IDD_MY_DIALOG };<br />
double ValuesArray[200];<br />
I leave the .cpp file at the top the same, except that I remove the double ValuesArray[200]; line.
I am probaly doing several things wrong. Any help will be more than welcome.
I wish I could type better ...
|
|
|
|
|
spaced_out wrote:
I get a runtime error.
That sounds like visual basic to me... You mean exception? Which one Access Violation or Division by zero??
John
|
|
|
|
|
Sorry about that, is says I have an illegal operation. (too many different languages to keep up with.)
I am putting the read in values into a List Control. The scroll bar appears when I execute, but then it just stops before I see the data?
Here is the error message:
MYSOURCE caused an invalid page fault in<br />
module MSVCRT.DLL at 0167:7800a796.<br />
Registers:<br />
EAX=5f4b64b0 CS=0167 EIP=7800a796 EFLGS=00210246<br />
EBX=0063f600 SS=016f ESP=00540000 EBP=00540020<br />
ECX=005400a4 DS=016f ESI=817ce080 FS=5b67<br />
EDX=bff76855 ES=016f EDI=005400cc GS=0000<br />
Bytes at CS:EIP:<br />
55 8b ec 83 ec 04 53 56 57 fc 89 45 fc 33 c0 50 <br />
Stack dump:<br />
bff76849 005400cc 0063f600 005400e8 005400a4 005401d8 bff76855 0063f600 005400b4 bff87fe9 005400cc 0063f600 005400e8 005400a4 5f493801 00540290
I wish I could type better ...
|
|
|
|
|
Are you 100% sure that you are not stepping past the end of the array? Using an invalid index < 0 or > 199..
John
|
|
|
|
|
Good call. I don't know how I was doing it, but that change let me run the code. Unfortunately, after exit the dialog I get a new error message. I guess it works up to that point and that is something.
THanks. Helpful comments.
I wish I could type better ...
|
|
|
|
|
What error message do you get?
My first thoughts would be to move the declaration to outside of the ClassWizard generated code
class CMyDialog : public CDialog
{
public:
CMyDialog(CWnd* pParent = NULL);
enum { IDD = IDD_MY_DIALOG };
double ValuesArray[200];
};
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
I moved it outside, but I still get an error (once the code is done running). It works up until that point. Thanks to me changing the size of the array. I swear I had it set up correct, but I guess not.
This is the error message I get when I do it inside the ClassWizard zone
MYSOURCE caused an invalid page fault in<br />
module MSVCRT.DLL at 0167:78009dd3.<br />
Registers:<br />
EAX=00000000 CS=0167 EIP=78009dd3 EFLGS=00210246<br />
EBX=0063f600 SS=016f ESP=00540000 EBP=00540034<br />
ECX=005400dc DS=016f ESI=817f7600 FS=20d7<br />
EDX=bff76855 ES=016f EDI=00540104 GS=0000<br />
Bytes at CS:EIP:<br />
55 8b ec 56 8b 75 18 57 bf 20 05 93 19 39 3e 74 <br />
Stack dump:<br />
7800a7bc 00540104 0063f600 00540120 005400dc 5f4b5948 00000000 00000000 00000000 00540104 817f7600 0063f600 5f4b5948 00540058 bff76849 00540104
This is what I get if I am outside the Class Wizard stuff:
MYSOURCE caused an invalid page fault in<br />
module MSVCRT.DLL at 0167:78009dd3.<br />
Registers:<br />
EAX=00000000 CS=0167 EIP=78009dd3 EFLGS=00210246<br />
EBX=0063f600 SS=016f ESP=00540000 EBP=00540034<br />
ECX=005400dc DS=016f ESI=817f7c40 FS=3227<br />
EDX=bff76855 ES=016f EDI=00540104 GS=0000<br />
Bytes at CS:EIP:<br />
55 8b ec 56 8b 75 18 57 bf 20 05 93 19 39 3e 74 <br />
Stack dump:<br />
7800a7bc 00540104 0063f600 00540120 005400dc 5f4b5948 00000000 00000000 00000000 00540104 817f7c40 0063f600 5f4b5948 00540058 bff76849 00540104
Keeping in ming that if I define the array inside of the subroutine-locally (or function? I don't know the right word.) I get no error at all???
I wish I could type better ...
|
|
|
|
|
spaced_out wrote:
for (int i=0; i < 199; i++) // loop 200 times for 200 lines of data
FYI, this only loops 199 (0-198) times. That's not the issue at hand, though.
When you are read from the ValuesArray[] array, adding the values to the list control, what line of code causes the error? Is it an access violation, or a fired assertion?
|
|
|
|
|
Thanks for the 0-198 clarification.
The error is posted in my reply above. I have NO IDEA what it means?
I wish I could type better ...
|
|
|
|
|
hehe, i'm sure it is a stack overflow... because of page fault...
you define the CDialog class local in the InitInstance function of the program, right??
then it makes no difference, if you place the whole class in stack or just the 200 doubles.
define the CDialog class GLOBAL, then it should work!
Don't try it, just do it!
|
|
|
|
|
200 doubles is not a lot of memory.
John
|
|
|
|
|
Do you have another way for me to define these numbers that would take up less space?
Instead of double?
If so let me know.
I wish I could type better ...
|
|
|
|